Custom Post Type & Custom Taxonomy's URL Rewrite to remove their slugs

Custom Post Type & Custom Taxonomy's URL Rewrite to remove their slugs

If you ever need to remove slug completely from your WordPress's URLs for Custom Post Type or Custom Taxonomy, set 'slug' to '/' and 'with_front' to 'FALSE' for rewrite parameter while registering custom post type or custom taxonomy.

'rewrite' => array(
               'slug'       => '/', 
               'with_front' => FALSE
             ),

Don't forget to visit Settings->Permalinks page to flush old url rewriting rules to update changes.

Share this Post