i trying filter taxonomy args on selection of custom taxonomies register_taxonomy_args filter hook. when doing getting quite lot of error messages.
to list few:
warning: missing argument 2 edit_bb_taxonomy_args() in /applications/mamp/htdocs/broadbean/wp-content/themes/scratch/functions.php on line 278
warning: missing argument 3 edit_bb_taxonomy_args() in /applications/mamp/htdocs/broadbean/wp-content/themes/scratch/functions.php on line 278
notice: undefined variable: taxonomy in /applications/mamp/htdocs/broadbean/wp-content/themes/scratch/functions.php on line 280
warning: array_merge(): argument #2 not array in /applications/mamp/htdocs/broadbean/wp-includes/taxonomy.php on line 379
notice: undefined index: rewrite in /applications/mamp/htdocs/broadbean/wp-includes/taxonomy.php on line 398
my filter function
<?php function edit_bb_taxonomy_args( $args, $taxonomy, $object_type ) { $taxonomies = array( 'wpbb_job_type', 'wpbb_job_location', 'wpbb_job_industry', 'wpbb_job_skill' ); if ( in_array( $taxonomy, $taxonomies ) ) { $args = array( 'with_front' => false ); return $args; } } add_filter('register_taxonomy_args', 'edit_bb_taxonomy_args' ); ?>
what doing wrong? thanks.
no worries have sorted now.
if you're interested solution below...
<?php function my_edit_bb_taxonomy_args( $args, $taxonomy, $object_type ) { $taxonomies = array( 'wpbb_job_type', 'wpbb_job_location', 'wpbb_job_industry', 'wpbb_job_skill' ); if ( in_array( $taxonomy, $taxonomies ) ) { /* alter rewrite front arg */ $args[ 'rewrite' ][ 'with_front' ] = false; } return $args; } add_filter( 'register_taxonomy_args', 'my_edit_bb_taxonomy_args', 10, 3 ); ?>
Comments
Post a Comment