Custom taxonomy page for custom post
-
I have set up a custom post type – produce and succesfully added a custom taxonomy – ingredient
add_action( 'init', 'create_my_taxonomies', 0 ); function create_my_taxonomies() { register_taxonomy('ingredient',array('recipe','produce','post'), array( 'hierarchical' => false, 'label' => 'Ingredient', 'show_ui' => true, 'query_var' => true, 'rewrite' => array( 'slug' =>'ingredient' ), )); }This worked well, I put the tag in the template, it showed up on the single page and when I click on the link it takes me to my templates taxonomy.php file which correctly displays all the posts with this taxonomy. I also set up a menu item for this taxonomy which takes you to the same layout.
Today I added a second custom taxonomy
register_taxonomy( 'prodstatus', 'produce', array( 'hierarchical' => false, 'label' => 'Produce status', 'query_var' => true, 'rewrite' => true ) );I put this within the function create_my_taxonomies(). It shows up in the back end, I can add items and tag the produce it also shows up on single-produce.php but when I click the link or try to create a new item I get
Apologies, but the page you requested could not be found. Perhaps searching will help.
The path looks correct prodstatus/seed and I printed out the var using print_r($wp_query->query_vars); and they show prodstatus and seed. Been banging my head all day if anyone can see the error would be much appreciated
The topic ‘Custom taxonomy page for custom post’ is closed to new replies.