• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2787

Original Genesis & WooCommerce Tutorials & 6000+ Guaranteed Code

Snippets

  • Try Premium
  • Log in

Change Custom Post Type or CPT Taxonomy Permalink Slug

This simple solution enables you to customize the permalinks for your custom post types and CPT taxonomy types.

All you need to do is modify the slug for the rewrite parameter included in the code which registers your CPT or taxonomy.

This is the line which includes the slug custom-post-type-slug you can modify:

'rewrite' => array( 'slug' => 'custom-post-type-slug', 'with_front' => false ),

If you’ve also registered custom taxonomies, you would modify this slug custom-taxonomy-type-slug on this line in the code:

'rewrite'  => array( 'slug' => 'custom-taxonomy-type-slug', 'with_front' => false ),
Note: Don’t forget to re-save your permalinks after modifying the code as this will flush the rewrite rules which is needed to make the changes.

Here’s the full code which creates both a custom post type named portfolio and adds a page to create custom taxonomies for the portfolio CPT.

The code is included in the Executive Pro child theme by StudioPress and works in any theme.

Custom Post Type

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Code written by Brad Dalton specialist for Genesis, WooCommerce & WordPress theme customization. Read More…

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
  • Tags