Add Taxonomy Term Slug To CPT Permalink

This download folder includes the code which enables you to dynamically include the taxonomy type term slug to your custom post type permalinks on for single entries.

Example : If your CPT is named HUB and you create a custom type named Blogging, your permalink will change from this :

http://example.com/hub/new-hub-item/

To this :

http://example.com/hub/blogging/new-hub-item/

Where hub is the name of your custom post type, blogging is your taxonomy term followed by your entry title slug.

The code included in this download :

  • Creates a custom post type named Hub.
  • Creates a custom taxonomy named hub-taxonomy-type which adds support for creating unlimited custom term types from your admin screen.
  • Rewrites your single permalinks to include the custom term the single entry is assigned to.

Demo Video

Shows the term links for a CPT added to the single entry permalinks.

Tested using the Genesis Sample child theme by StudioPress however will work in any Genesis or WordPress theme.

Installation Steps

There’s 2 steps :

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

    Step 1

  3. # Go to Settings > Permalinks in your WordPress Dashboard and Resave your permalinks.
  4.  

    Step 2

You can then create custom taxonomy terms like these :

Taxonomy terms for custom post type

Download Folder

Join 5000+ Followers

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