The category prefix is part of the category archive pages URL slug. Removing the word category prefix from url shorten the url lenght which is also a part of SEO (If you category name is too big). Some developers and website owners also do it to maintain website aesthetics .
Well everybody has their own reason. this blog will guide you how to remove the category prefix from category URL with use of any plugin. We always recommend functionality without plugins.
The beauty of WordPress is that we can modify it as per our choice without hampering its core functionality.
Table of Contents
How default category page url looks
Let’s have a look at an example of what it could look like if you do not remove a category from a category page URL: https://yoursite.com/category/category-name

Option 1:
Removing Category prefix by Adding a Code in functions.php File
To add the code in function.php file. follow below setps:
- Go to your WordPress dashboard.
- Select Appearance >> Theme Editor.
- Make sure child theme is selected
- Find ‘functions.php’.
- Save the function.php file, load the URL on frontend
function remove_category( $string, $type ) { if ( $type != 'single' && $type == 'category' && ( strpos( $string, 'category' ) !== false ) ) { $url_without_category = str_replace( "/category/", "/", $string ); return trailingslashit( $url_without_category ); } return $string; } add_filter( 'user_trailingslashit', 'remove_category', 100, 2);
Option 2:
Modifying .htaccess to Remove Category prefix from category URL
You can access your .htaccess file either via FTP or cPanel/hpanel. If you can’t find the .htaccess file, check if your file manager is set up to show hidden files (dotfiles). if files are hidden, you have to select “Show hidden files from setting”
Follow the steps below
- Go to your .htaccess file.
- Add the below code after the closing tag in the file:
- Use your domain name in place of www.site.com in the code below.
- Upload it on your server’s public_html directory. replace the file if its ask.
RewriteRule ^category/(.+)$ http://www.site.com/$1 [R=301,L]
So that’s all folks. For anything else. You can connect our Dev here