Skip to content

How To Change WordPress Post Slug Without Any Plugin?

How To Change WordPress Post Slug Without Any Plugin?

This is a common question for every wordpress developer who wants to change the wordpress post slug without any plugin. But sometimes it's hard to do make changes without any plugin. If you don't have proper knowledge of wordpress theme development then I will recommend you don't do this. Because without proper knowledge of wordpress theme development it can damage your entire website. So, before making any changes please search on google how to change wordpress post slug without any plugin. Then follow the instruction of the developer who writes guidelines for you.

 

 

Now follow our instructions carefully before any changes. First of all, Install the wordpress code snippets plugin from wordpress.org.

Code Snippets is a popular wordpress plugin for custom codes. Like, PHP, Javascript, JS, HTML, and many more. You can add all types of custom codes to your website with the help of the code snippet plugin. After downloading code snippet plugin click on your wordpress dashboard -> plugins -> add new

 

Then upload the code snippets plugin from your computer and click on Install Now. Once the plugin is installed please activate your plugin. Then go to Snippets -> Add New.

Then Follow This:

Title: Replace wordpress post slug

Content: Paste the below code on your code snippet content and click on activate and make changes

add_filter( 'register_post_type_args', 'wpcodersclub_register_post_type_args', 10, 2 );function wpcodersclub_register_post_type_args( $args, $post_type ) {if ( 'portfolio' === $post_type ) {$args['rewrite']['slug'] = 'wpcodersclub';}return $args;}

As you can see, I want to change the Portfolio Slug to wpcodersclub Slug. So, Before activating the code snippets plugin please check your posts slug first. You have to specify the specific post type before any changes otherwise your site will be broken down and you have to restore it from back up again. I think that would be a lengthy process. So, Organize everything and make changes. Good Luck.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version