title: How do I use the same slugs for custom post types and taxonomies in WordPress
body: <p>I'm new here and I need your help because I don't understand how to solve this.</p>
  
  <p>I need to register a new custom post type "tutorials", because I want to have a different design for them, and keep them separately from the rest of posts. I also want to organize them in categories, so I will use taxonomies for this. I have read many tutorials (here and from Google) and I found many ways to do this, but the result isn't what I have expected. Finally, I wrote this code in a plugin:</p>
  
  <pre><code>&lt;?php
     /*
     Plugin Name: My Custom Post Types
     Description: A plugin for our custom post types like tutorials etc.
     */
  
  /*====================================================
  Register new custom post type - tutorials
  ======================================================*/
  function register_my_custom_post_type_tutorials() {
    $labels = array(
      'name'               =&gt; 'Tutorials',
      'singular_name'      =&gt; 'Tutorial',
      'add_new'            =&gt; 'Add New',
      'add_new_item'       =&gt; 'Add New Tutorial',
      'edit_item'          =&gt; 'Edit Tutorial',
      'new_item'           =&gt; 'New Tutorial',
      'all_items'          =&gt; 'All Tutorials',
      'view_item'          =&gt; 'View Tutorial',
      'search_items'       =&gt; 'Search Tutorials',
      'not_found'          =&gt; 'No tutorials found',
      'not_found_in_trash' =&gt; 'No tutorials found in Trash',
      'parent_item_colon'  =&gt; '',
      'menu_name'          =&gt; 'Tutorials'
    );
  
    $args = array(
      'labels'             =&gt; $labels,
      'public'             =&gt; true,
      'publicly_queryable' =&gt; true,
      'show_ui'            =&gt; true,
      'show_in_menu'       =&gt; true,
      'query_var'          =&gt; true,
      'rewrite'            =&gt; array( 'slug' =&gt; 'tutorials' ),
      'capability_type'    =&gt; 'post',
      'has_archive'        =&gt; true,
      'hierarchical'       =&gt; false,
      'menu_position'      =&gt; null,
      'supports'           =&gt; array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments','custom-fields','page-attributes','post-formats' )
    );
  
    register_post_type( 'wizz-tutorials', $args );
  }
  add_action( 'init', 'register_my_custom_post_type_tutorials' );
  
  /*====================================================
  Register Custom Taxonomies for Tutorials - Categories
  ======================================================*/
  
  add_action('init', 'register_tutorials_taxonomy');
  
  function register_tutorials_taxonomy() {
  // Add new taxonomy, make it hierarchical (like categories)
    register_taxonomy('wizz-tutorials-category',
                      'wizz-tutorials',
                       array (
                             'labels' =&gt; array (
                                                'name' =&gt; 'Tutorials Categories',
                                                'singular_name' =&gt; 'Tutorials Categories',
                                                'search_items' =&gt; 'Search Tutorials Categories',
                                                'popular_items' =&gt; 'Popular Tutorials Categories',
                                                'all_items' =&gt; 'All Tutorials Categories',
                                                'parent_item' =&gt; 'Parent Tutorials Category',
                                                'parent_item_colon' =&gt; 'Parent Tutorials Category:',
                                                'edit_item' =&gt; 'Edit Tutorials Category',
                                                'update_item' =&gt; 'Update Tutorials Category',
                                                'add_new_item' =&gt; 'Add New Tutorials Category',
                                                'new_item_name' =&gt; 'New Tutorials Category',
                                              ),
                              'hierarchical'     =&gt; true,
                              'show_ui'          =&gt; true,
                              'show_tagcloud'    =&gt; true,
                              'rewrite'          =&gt; array( 'slug' =&gt; 'tuts-category' ),
                              'public'           =&gt; true
                              )
                       );
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>In the admin panel, now I can add "tutorials". I have also created some categories for them (photoshop, web, etc.). The problem is with the slug.</p>
  
  <p>What I have at the moment:</p>
  
  <ul>
  <li><p><code>mywebsite.com/tutorials/</code> - archive of all tutorials (using
  <code>archive.php</code>)</p></li>
  <li><p><code>mywebsite.com/tutorials/post-name</code> - display the tutorial (using
  <code>single.php</code>)</p></li>
  <li><p><code>mywebsite.com/tuts-category/photoshop/</code> - displays only tutorials that
  belong to this category</p></li>
  </ul>
  
  <p>This is perfect, but I want something different:</p>
  
  <ul>
  <li><p><code>mywebsite.com/tutorials/</code></p></li>
  <li><p><code>mywebsite.com/tutorials/post-name</code></p></li>
  <li><p><code>mywebsite.com/tutorials/photoshop/</code></p></li>
  </ul>
  
  <p>But if there is a change to the slug for taxonomies, e.g., <code>'rewrite' =&gt; array( 'slug' =&gt; 'tutorials' )</code>, I'm getting a <code>404 error</code>.</p>
  
  <p>Is there a way to do this? And another question, is my code correct? Thanks!</p>