wordpress

How To Remove Category From Your URLs In WordPress

I was trying to work out how to remove /category/ from my category URLs and I just couldn’t seem to remove it. For example jonnyjordan.com/category/blog I just wanted to be jonnyjordan.com/blog, but I found out a quick trick to achieve this.

To get rid of category you set your permalinks to /%category%/%postname%/ and then set the Category Base to period/dot.

*If you leave the category base blank it will display the wordpress default category.*

  1. Go to Setting > Permalinks
  2. Select Custom Structure
  3. Add /%category%/%postname%/ after your domain
  4. Change Category Base to period/dot.

How to remove Category from Your URLs in WordPress

Removing Category From Your URLs With Yoast’s SEO Plugin

Another quick way to remove category from your URLs is to use the Yoast SEO plugin. Yoast comes with a handy setting to remove the category base for you.

  1. Go to Yoast SEO
  2. Select advanced
  3. Click on the tab permalinks at the top
  4. Check Strip the category base (usually /category/) from the category URL.

removing category from urls plugin

Removing Category From Your URLs With .htaccess

To remove the category base manually in the .htaccess file just add this line of code.

RewriteRule ^category/(.+)$ http://www.site.com/$1 [R=301,L]

Removing The Category Base with the Remove Category URL Plugin

This plugin also removes the category base and seems to be very popular as well. I would recommend this method the least because too many plugins will slow your website down and require you to keep more plugins up to date. https://wordpress.org/plugins/remove-category-url/

remove category plugin

Conclusion

All four methods above will work for removing the category slug from your URLs. Although I would recommend choosing the method that is going to use less code in your case.


Tags: , ,


Please share if you found this useful

Recent posts

How to Fix the Wrong Facebook Share Link Thumbnail Image with WordPress

When sharing links on Facebook have you ever noticed the wrong thumbnail image displaying? If a URL has been shared…

Read More
wordpress

Why the_date() Function in WordPress Only Shows Up Once on the First Post

I was building a blog on WordPress and I realised the function the_date() was only showing up on the first…

Read More
how to remove the send email button off the macbook 2016 touch bar on apple mail

How to Remove the Send Email Button Off the Macbook 2016 Touch Bar on Apple Mail

I bought the new Macbook Pro 2016 and it’s been working great so far, except one problem. Every time I’m…

Read More
Let's Work Together!

I’m currently available for freelance web design work in Belfast now.