Posted on Leave a comment

How to Remove “Category” From Your URLs in wordpress

There are many different reasons why you would want to remove the /category/ from your urls. One reason is it gives you better SEO performance or maybe you just want cleaner URLs.

First thing, in WordPress ( Version 4.9.7 or above ) head on over to Settings/Permalinks and set your custom structure permalinks to /%category%/%postname%/ by clicking on the buttons below it.

(Make sure you remove any pages or posts with the same category url.)

Now save your settings.

Your category page url should normally look like this.

https://mywebsite.com/category/my-custom-category/

After you saved your settings go to the front end of the site and remove /category/ from your link url, make sure it looks like this.

https://mywebsite.com/my-custom-category/

There you go, everything should work like before except now you don’t have /category/ in your url.

Extra Bonus: How to use the new categories links.

  1. Do not use widgets categories as they contain he old link structure
  2. Create a new menu for your new categories with the new link structure and display it with the menu widget.
  3. Remove any categories in the post meta footer.

Add this code to your functions.php file to remove category links in post meta:

if (!(is_admin() )) {
add_filter('the_category', 'no_links', 45);
function no_links(){
echo " ";
}
}

That’s it. If you have any questions leave them below.

Leave a Reply

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