0

I created a custom taxonomy like so:

function my_taxonomies_custom() {
      $labels = array(
        'name'              => _x( 'Post Categories', 'taxonomy general name' ),
        'singular_name'     => _x( 'Post Category', 'taxonomy singular name' ),
        'search_items'      => __( 'Search Post Categories' ),
        'all_items'         => __( 'All Post Categories' ),
        'parent_item'       => __( 'Parent Post Category' ),
        'parent_item_colon' => __( 'Parent Post Category:' ),
        'edit_item'         => __( 'Edit Post Category' ), 
        'update_item'       => __( 'Update Post Category' ),
        'add_new_item'      => __( 'Add New Post Category' ),
        'new_item_name'     => __( 'New Post Category' ),
        'menu_name'         => __( 'Post Categories' ),
      );
      $args = array(
        'labels' => $labels,
        'hierarchical' => true,
        'rewrite' => array(
            'slug' => 'custom_category',
            'with_front' => true,
            'hierarchical' => true ,
        ),
      );
      register_taxonomy( 'custom_category', 'post_type_slug', $args );  
    }
    add_action( 'init', 'my_taxonomies_custom', 0 );

With a custom category through the admin called postcat. From my understanding I should be able to now go to the URL http://example.com/custom_category/postcat and this will use the category.php page to display a list of pages in the category. When I go to this URL though all I get is a page that says "Not found. Sorry, but your request could not be completed."

  • Sorry to ask such a newb question: did you reset your permalinks after? – Andy Jul 15 '15 at 16:13
  • Sure did. If I use a plugin to add custom taxonomies to the side bar it cant even find any. Like this one is not being saved even though I can see it. – Packy Jul 15 '15 at 16:20
  • does your actual code contain a valid post type in place of post_type_slug? did you assign the category to any posts? does your normal post permalink structure contain anything static (setting with_front to true will prepend that value if that's the case)? – Milo Jul 15 '15 at 16:23
  • category.php template file is only for core categories taxonomy. The equivalent for custom taxonomies is taxonomy.php. See template hierarchy for more information. Anyway, the template file used doesn't seem to be the source of your problem. Follow Milo's suggestions. – cybmeta Jul 15 '15 at 16:23
  • 1
    @cybmeta if you post your answer as an answer and not a comment I will accept it. Thanks. – Packy Jul 15 '15 at 16:33
0

category.php template file is only for core categories taxonomy. The equivalent for custom taxonomies is taxonomy.php. See template hierarchy for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.