Categories are a very important feature of any WordPress website. They are very helpful to maintain or browse a website. They tell you what’s related to what and they give your visitors a good way to browse your site. But sometimes they are not serving your URL structures. Then what should you do?
Don’t worry guys we have are here to help. Today we are going to show how to fix this.
So, there are different ways to achieve the same and we are going discuss them one by one. Just remember that if you have a fresh WordPress installation then set up permalinks as you want. But if you are changing permalinks structure on a live website, do properly, redirect old URLs to new ones to avoid loses.
Remove Category from WordPress URLs with a Dot
- Go to Settings -> Permalinks.
- Select Custom Structure and put /%category%/%postname%/ there.
- Assign a dot to the Category base field and save the change.
The below picture will help you to understand.
Please remember that providing dot to Category base in settings is a must. As leaving it blank will use the default value. Visit a post after saving settings and check the URL, it won’t have the category base now. While this trick currently works, there’s no assurance that it will work in the future as well.
Remove Category From Your URLs with .htaccess
You can also add this code to your .htaccess file through FTP rather than using a dot. Add the code before the closing </IfModule> tag in the file and it will remove the category slug from WordPress permalink.
What if I am using Yoast SEO Plugin
The current version of SEO by Yoast plugin has discontinued the option of category removal from URLs. The last version had the option in the Advanced menu of plugin settings. The websites, who are using Yoast for a long time, still have their URLs without the category base.
If you’ve installed Yoast plugin on your fresh WordPress website, check the post URLs as well. While we’re not sure, the feature might be still there and working silently. Else there are other plugins as well to remove category slug.
Removing Category from Slug using a Plugin.
The plugin ‘Remove Category URL’ is much popular and has additional advantages too. You can try the plugin if your website is older than 6 months. It will redirect the old category permalinks to the new ones, which is better for SEO. Also, you don’t need to configure anything or modify a file. Get the WordPress official plugin URL here.
Although you can always write a function for the functionality it makes the site slower. At last, all easy methods to remove the category slug from URLs are there. Do let us know in the comment section which one do you prefer.