1

I'm using custom hierarchical taxonomy that is attached to custom post with following structure:

www.mysite.com/movies/drama/example/

where "movies" is a slug for custom taxonomy and "drama" is an sub item for "movies" taxonomy.

In permalink settings I have "Post name" turned on.

Now the problem is that when I type:

www.mysite.com/movies/

I get 404 (Page not found). But when I type:

www.mysite.com/movies/drama/

My taxonomy.php template is recognized and I'm able to show list of categories using wp_list_category();

How can I convince Wordpress to recognize /movies/ as a custom taxonomy slug not a page?

Here's the code for registering that taxonomy:

$args = array(
    'labels'                     => $labels,
    'hierarchical'               => true,
    'public'                     => true,
    'show_ui'                    => true,
    'show_admin_column'          => true,
    'show_in_nav_menus'          => true,
    'show_tagcloud'              => true,
    'query_var'                  => true,
    'rewrite'                    => array('slug' => 'movies', 'with_front'=>false, 'hierarchical'=>true),
);
register_taxonomy( 'entry_category', array( 'movies_entry' ), $args );
register_taxonomy_for_object_type( 'entry_category', 'movies_entry' );

Thanks in advance:)

  • Just to clarify where do you expect www.mysite.com/movies to take you to? As it stands you have your site setup to go to www.mysite.com/movies/%taxonomy% but no www.mysite.com/movies/ – noelmcg Nov 4 '14 at 12:46
  • The /movies is the taxonomy slug. I would like to have an overview of all subcategories there. Suppose I have an entry of Lord Of the Rings. That is a "fantasy" "movie", so the URL will be: mysite.com/movies/fantasy/Lord-Of-The-Rings. "/movies" part is the custom taxonomy. "/fantasy" part is the subcategory in that taxonomy and "/Lord-Of-The-Rings" is the actual post in that category. Now I have also another taxonomy on the site "music" so on that very site I'd also like to use urls like these: mysite.com/music/soundtrack/Lord-Of-The-Rings – wyktor Nov 5 '14 at 19:13
  • Can a movie be under more than one sub category? – noelmcg Nov 5 '14 at 19:29
  • Yes it can. Although not under /music only within /movies taxonomy – wyktor Nov 6 '14 at 19:46
  • I cant understand why you haven't created a page movies, that has a list of all the different movie sub-categories? – noelmcg Nov 11 '14 at 14:35

Your Answer

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

Browse other questions tagged or ask your own question.