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:)

6
  • 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
    Commented Nov 4, 2014 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
    Commented Nov 5, 2014 at 19:13
  • Can a movie be under more than one sub category?
    – noelmcg
    Commented Nov 5, 2014 at 19:29
  • Yes it can. Although not under /music only within /movies taxonomy
    – wyktor
    Commented Nov 6, 2014 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
    Commented Nov 11, 2014 at 14:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.