Remove Modify Slug From Permalinks For Single CPT Post and Taxonomy Term Pages

The code in this download folder enables you to remove the slug from the permalinks for single custom post types and taxonomy term archive pages.

In this case, the default permalink for single posts of a custom post type,before adding the code is

example.com/cpt-name/single-post

And the taxonomy term permalink is

example.com/taxonomy/term-slug

After the code is added, the cpt-name can be removed and taxonomy type slug can be modified producing a permalink like this for the single post :

example.com/single-post

And a permalink like this for the taxonomy term

example.com/cat/term-slug

Also included in this download folder is code for :

  • Creating your custom post
  • Creating your taxonomy terms using the interface added via code without adding more code for each new term
  • A single template for customizing/modifying single CPT’s
  • A taxonomy template for customizing/modifying your taxonomy term archive pages for each term

Remove Slug From Permalinks For Single CPT Post and Taxonomy Term Pages

Demo Video

Shows the admin interface for creating single custom post types AND custom taxonomy terms for your CPT.

Shows the CPT slug removed from the single post and the taxonomy slug modified for the taxonomy term archive page.

Tested using the Genesis Sample child theme by StudioPress however will work in any Genesis child theme and non Genesis themes.

Installation Steps

There’s 2 steps :

  1. # Copy & paste the PHP code ( Without the opening PHP tag ) from the functions.php file to the end of your child themes functions file
  2.  
    Step 1

  3. # Upload the files named single-industry & taxonomy-industry-type.php to your child theme folder:
  4.  
    Step 2

Make sure you resave your permalinks after installing the code. Go to Dashboard > Settings > permalinks and click Save.

Note : To change the name of your custom post type and taxonomy, use a code editor application like BB Edit for Mac or Notepad ++ to search & replace all instances of industry with the name of your CPT.

Download Folder

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.