How to Remove Category Word from Default WordPress Permalinks

by • On Jan 29, 12 23:29pm, Updated: Feb 8, 12 11:57am • 2365 Views

WordPress TipsIf you are quite familiar with the WordPress platform, then you already know that you have lots of options available to play around with the Permalink structure of your site or blog. You can choose either the Default, Day and name, Month and name, Numeric and Post name or even the “Custom Structure” from “Settings > Sidebar”.

Interesting enough, most people prefers the “Custom structure” for their WordPress site’s Permalinks. But no matter how or whatever the structure you choose, WordPress always adds the “Category” word within the URL. Let me give you an example, let’s say you wrote few posts under “Personal” category. If you click on “Personal”, it will show you all the posts under that category and the URL would be something like:

Frankly, this structure pisses me off because I don’t think we need the “Category” word on that URL. I would rather prefer even simpler URL which should be like this:

Simple, isn’t it? I think it looks better as well and it’s easy to understand. Now, the question is how we can get rid of that “Category” word? I read somewhere, some people were suggesting to edit .htaccess file which I definitely don’t think the best choice. Especially, if you are bit new on site management related issues and WordPress, you better stay away from them or learn first how to edit them.

Now, the best choice would be simply adding the following snippet code on your theme’s functions.php file and save it. It will remove the “Category” word from the permalinks and will rewrite the URL without the word.

add_filter('user_trailingslashit', 'remcat_function');
function remcat_function($link) {
return str_replace("/category/", "/", $link);
add_action('init', 'remcat_flush_rules');
function remcat_flush_rules() {
global $wp_rewrite;
add_filter('generate_rewrite_rules', 'remcat_rewrite');
function remcat_rewrite($wp_rewrite) {
$new_rules = array('(. )/page/(. )/?' => 'index.php?category_name='.$wp_rewrite->preg_index(1).'&paged='.$wp_rewrite->preg_index(2));
$wp_rewrite->rules = $new_rules $wp_rewrite->rules;

This is How you Should Proceed
Step 1: Log in to your WordPress site.
Step 2: Go to “Appearance > Editor” and select the functions.php file.
Step 3: Copy the code(above) and paste it all the way bottom of the file.
Step 4: Update the file.
Yes, you are done. All you have to do now, is to check the Category URL structure once again. If everything goes smoothly, you should not see the “Category” word within the default WordPress permalinks anymore. If for some reason it doesn’t work properly, feel free to make comments or ask questions below.

If you like our posts or site, feel free to subscribe our RSS Feed or Like us on Facebook. Thank you.

You can follow us on Twitter, add on your Google+ circle or Like our Facebook page to get the latest news, updates and reviews.