Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have tried refreshing my permalinks but I still cant get this to work correctly.

I have the categories movies, gaming, blu-ray, and tv already created, so my URLs are site.com/movies/ for example. I would like for a post for movies to be at site.com/movies/post-here/ so for my custom post type my slug is `movies.

All my normal wordpress psots under the category movies are now 404ing while posts created specifically from the post type Movie Posts is working fine. Is this normal? Is there a step I'm not including?

Here are all my custom post types (Created with Custom Post Type UI):

//Movies Custom Post Type
register_post_type('movies_cp', array(  'label' => 'Movie Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'movies'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'Movie Posts',
  'singular_name' => 'Movie Post',
  'menu_name' => 'Movie Posts',
  'add_new' => 'Add Movie Post',
  'add_new_item' => 'Add New Movie Post',
  'edit' => 'Edit',
  'edit_item' => 'Edit Movie Post',
  'new_item' => 'New Movie Post',
  'view' => 'View Movie Post',
  'view_item' => 'View Movie Post',
  'search_items' => 'Search Movie Posts',
  'not_found' => 'No Movie Posts Found',
  'not_found_in_trash' => 'No Movie Posts Found in Trash',
  'parent' => 'Parent Movie Post',
),) );


//Gaming Custom Post Type
register_post_type('gaming_cp', array(  'label' => 'Gaming Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'gaming'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'Gaming Posts',
  'singular_name' => 'Gaming Post',
  'menu_name' => 'Gaming Posts',
  'add_new' => 'Add Gaming Post',
  'add_new_item' => 'Add New Gaming Post',
  'edit' => 'Edit',
  'edit_item' => 'Edit Gaming Post',
  'new_item' => 'New Gaming Post',
  'view' => 'View Gaming Post',
  'view_item' => 'View Gaming Post',
  'search_items' => 'Search Gaming Posts',
  'not_found' => 'No Gaming Posts Found',
  'not_found_in_trash' => 'No Gaming Posts Found in Trash',
  'parent' => 'Parent Gaming Post',
),) );


//Blu-ray Custom Post Type
register_post_type('blu-ray_cp', array( 'label' => 'Blu-Ray Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'blu-ray'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'Blu-Ray Posts',
  'singular_name' => 'Blu-Ray Post',
  'menu_name' => 'Blu-Ray Posts',
  'add_new' => 'Add Blu-Ray Post',
  'add_new_item' => 'Add New Blu-Ray Post',
  'edit' => 'Edit',
  'edit_item' => 'Edit Blu-Ray Post',
  'new_item' => 'New Blu-Ray Post',
  'view' => 'View Blu-Ray Post',
  'view_item' => 'View Blu-Ray Post',
  'search_items' => 'Search Blu-Ray Posts',
  'not_found' => 'No Blu-Ray Posts Found',
  'not_found_in_trash' => 'No Blu-Ray Posts Found in Trash',
  'parent' => 'Parent Blu-Ray Post',
),) );


//TV Custom Post Type
register_post_type('tv_cp', array(  'label' => 'TV Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'tv'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'TV Posts',
  'singular_name' => 'TV Post',
  'menu_name' => 'TV Posts',
  'add_new' => 'Add TV Post',
  'add_new_item' => 'Add New TV Post',
  'edit' => 'Edit',
  'edit_item' => 'Edit TV Post',
  'new_item' => 'New TV Post',
  'view' => 'View TV Post',
  'view_item' => 'View TV Post',
  'search_items' => 'Search TV Posts',
  'not_found' => 'No TV Posts Found',
  'not_found_in_trash' => 'No TV Posts Found in Trash',
  'parent' => 'Parent TV Post',
),) );
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

If I understand what you are doing...

If you have categories set to load at "/category-name/" and a category named "/movies/" and a custom post type set to load at "/movies/" you've got conflicting elements. The rewrite rules are competing. That is going to be problematic. If you set has_archive to false when you register the post type, WordPress will not create the "/movies/" archive page and that might get you a step forward (though you won't have an archive page for the CPT), but you are still mixing category URLs and custom post type URLs so I'd expect there to be other problems.

My answer is going to be "I doubt you will ever get this working right and even if you can approximate something functional you probably shouldn't".

share|improve this answer
    
what would be the best way to get the content for my post types under their categories so i can have site.com/movies/movie-posts-here structure? Is it just impossible with custom post types? –  Joe Bobby Nov 12 '12 at 14:45
    
What you describe is what you would get if you just had a custom post type named 'movies', assuming it is registered correctly. The problem is that you seem to be mixing that up with categories which are at a nonstandard address to boot. The "movies" category would be at "category/movies" by default. –  s_ha_dum Nov 12 '12 at 14:55
    
if I were to just have the custom post types, would it be possible for /movies/ to list pages like an archive? or maybe a way to stop the custom post type from generating a URL –  Joe Bobby Nov 12 '12 at 15:31
    
"... would it be possible for /movies/ to list pages like an archive?"--- yes, set has_archive to true in your second register_post_type parameter and that is what would happen by default. (You may need to reset your permalinks for it to take effect) That is, you would have an archive at "/movies/" that would list the posts in the "movies" post type. It is explained in the Codex. –  s_ha_dum Nov 12 '12 at 16:04
    
thanks! before I go ahead with this route, I'm creating custom post types for an already existing website and it has the categories movies, gaming, tv`, blu-ray.. so would it be impossible to continue using post types with those categories? if it is, do you have a suggestion for how to get the posts in those categories under the custom post type archive instead? –  Joe Bobby Nov 12 '12 at 16:50
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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