Change the slugs of custom post types

Change the default URLs of your content types to a custom value.
Back to Advanced Theme Usage

Our latest themes come with filters that enable you to change the slug of any public custom post type. The public post types and the associated slugs are the following, which may or may not be used in a particular theme:


  • Portfolio items: cpotheme_slug_portfolio
  • Portfolio Categories: cpotheme_slug_portfolio_category
  • Portfolio Tags: cpotheme_slug_portfolio_tag


  • Services: cpotheme_slug_service
  • Service Categories: cpotheme_slug_service_category
  • Service Tags: cpotheme_slug_service_tag


  • Products: cpotheme_slug_product
  • Product Categories: cpotheme_slug_product_category
  • Product Tags: cpotheme_slug_product_tag

If you want to change the slug of any of these from their defaults, you can use the following code snippet. For example, to change the slug of portfolio categories (which is normally portfolio-category) to book-types, use the following:

add_filter('cpotheme_slug_portfolio_category', 'mytheme_change_portfolio_slug');
function mytheme_change_portfolio_slug($data){ 
    return 'book-types'; 

You can add this in the functions.php file of your theme, though it’s generally recommended to create a small plugin to keep the theme update-safe.

Another option would be to change them from your dashboard > Settings > CPO Content Types > and add in the appointed fields the slugs you want. Keep in mind afterwards to go to Settings > Permalinks > and click save to make sure they were updated correctly.