If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

WordPress Blogging themes. How to change custom post type slug

This tutorial is going to show you how to change custom post type slug in WordPress Blogging templates.

There are standard custom post type slugs in WordPress Blogging themes, e.g. “cherry-services” for Services posts etc.

WordPress_Blogging_themes._How_to_change_custom_post_type_slug_1

Let’s say you want to change “cherry-services” to “our-services”. To do that, please, follow the steps listed below:

  1. Log into your WordPress admin panel and navigate to the Appearance > Editor page.

    WordPress_Blogging_themes._How_to_change_custom_post_type_slug_2

  2. Locate functions.php file on the right side. Click on it. Once you do that you will see file content in front of you.

    WordPress_Blogging_themes._How_to_change_custom_post_type_slug_3

  3. Scroll down to the very end of the file and add the following code right before the closing PHP tag:

    add_filter( 'cherry_services_post_type_args', '_my_rewrite_slug' );
    			function _my_rewrite_slug( $args ) {
    			$args['rewrite']['slug'] = 'our-services';
    			return $args;
    		}
  4. Remember to replace our-services with your new slug.

  5. Click Update File button to save the change.

    WordPress_Blogging_themes._How_to_change_custom_post_type_slug_4

Note! In order to have the actual slug changed on your frontend you need torefresh the permalinks:

  1. Open the Settings > Permalinks page in your backend.

  2. Click the Save Changes button.

    WordPress_Blogging_themes._How_to_change_custom_post_type_slug_5

Now you can check your site. Open services post to see successful slug change.

Feel free to check the detailed video tutorial below:

WordPress Blogging themes. How to change custom post type slug