Categories

Featured templates

WordPress Blogging themes. How to change custom post type slug

Ammy Brown February 21, 2017
Rating: 5.0/5. From 1 vote.
Please wait...

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
Buy Wordpress Themes
This entry was posted in WordPress Tutorials and tagged custom, slug, WordPress Blogging themes. Bookmark the permalink.

Submit a ticket

If you are still unable to find a sufficient tutorial regarding your issue please use the following link to submit a request to our technical support team. We'll provide you with our help and assistance within next 24 hours: Submit a ticket