Posted on 3 Comments

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 5.0.0 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.

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.

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

Extra Bonus: How to use and display 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 links in the post meta footer.

To remove any links and only display category text in search and post meta page add this code to your functions.php file:

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.

3 thoughts on “How to Remove “Category” From Your URLs in wordpress

  1. Hey – nice article, how do I remove links from a category in the post meta in search results. I want to keep the text/category label, just don’t want it to be a link. Thanks

    1. You will need to edit your search results theme page and add or replace (get_the_category) with the code snippet below in your theme file to display category in plain text.

      <?php single_cat_title(); 
      //prints category in plain text 
    2. good question, I need the same (I am using divi builder). I don’t understand brody’s reply. How do I use this to remove the category link to just keep the plain text?

Leave a Reply

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