How To Remove the Category From the WordPress URL
parallax background

How To Remove the Category From the WordPress URL

Amazing web design portfolio websites (40+ Examples)
April 15, 2024
Website Launch Announcement Ideas and Tactics To Use
April 16, 2024
Amazing web design portfolio websites (40+ Examples)
April 15, 2024
Website Launch Announcement Ideas and Tactics To Use
April 16, 2024
 

Imagine clicking a URL, expecting a clean, streamlined address, only to be met with a clunky categorization nightmare. It doesn't just itch; it irks. It's the digital equivalent of a snag in a silk stocking. It can happen in WordPress, a platform celebrated for its customization yet sometimes puzzling with its permanent link, or 'permalink', structures.

Clean and precise URLs are not just about aesthetics; they're a cornerstone of effective SEO and user experience. Today, the spotlight shines on a common quandary: how to remove the category from the WordPress URL. This tweak not only refines your site's URLs but boosts your SEO efforts, enhancing site indexing and visibility in search engines.

By the closure of this exploration, you will master the art of removing unnecessary category tags from your WordPress URLs using .htaccess file adjustments, permalink settings, and essential plugins like Yoast SEO. Step into the realm of cleaner URLs and witness your site rise in the ranks of user-friendly digital spaces.

Reasons to Remove Category From WordPress URL

 

The category prefix is part of the URL slug. As any SEO-conscious website developer or owner, your goal is to optimize this feature.

What exactly does URL slug refer to? It is the part of your address that comes right after the domain name. It identifies the resource, a specific page on your site. The slug tells search engines where to find your web page. Moreover, visitors can understand from the keywords what the page is about.

Slugs are usually generated by default from a page title, but they can be changed manually. Ideally, a clean SEO-friendly URL contains only meaningful and relevant keywords. They should be intuitive and easy to understand by both search engines and visitors. However, that's not the only relevant thing when it comes to the SEO of your website, as the speed of the website, UX and the importance of good link building, which can be assessed using a backlink audit checker, is also necessary.

That's the reason why some developers may decide to remove the category prefix from the URL.

Let's have a look at an example of what it could look like if you remove a category from a WordPress URL:

If the original slug was ‘yoursite.com/category/best-seo-practices’, the modified slug would be ‘yoursite.com/best-seo-practices’.

The link in the example above now looks cleaner while it still includes the keywords which are important for SEO. A visitor who found your page using a search engine will also directly see the content he was looking for.

If you modify the permalinks of your site, make sure you redirect old URLs to your new ones. Otherwise, users visiting the old category page will run into an error.

So far, we’ve explained why you may decide to remove categories and what you should be careful about.

Here are some tips on how to take the prefix out of the URL slug.

Modifying Category Base Prefix

 

Some developers don't mind the length of the URL slug, but they want to personalize it.

In such a case, you can change the Category base. Instead of 'Category', you can customize the prefix to 'Articles', 'Topics', 'Blog', 'Genre', 'Tutorials', or similar.

To demonstrate what the edited slug will look like, we can use the same example mentioned earlier.

If the original slug was ‘yoursite.com/category/best-seo-practices’, the new URL could be ‘yoursite.com/articles/best-seo-practices’.

You can modify the category base prefix if you go to the Settings in your WordPress admin.

  • Go to your admin dashboard.
  • Go to Settings >> Permalinks >> Optional >> Category base.
  • Enter your customized category base (e.g. 'Articles')
  • Save the changes.

By making this modification, you can personalize the category prefix in your WordPress URL. But you may decide to completely remove it.

Remove Category in WordPress Permalinks

 

This is an option that allows you to take out the Category prefix completely by modifying your site's permanent link settings.

Here is the process described step by step:

  • Connect to your WordPress dashboard.
  • Go to Settings >> Permalinks.
  • Go to Custom Structure and put ‘/%category%/%postname%/’.
  • Go to Category Base and type in a dot “. “.
  • Save the changes.

The category prefix was removed by typing the dot in the Category Base field. If the field is left blank, WordPress will use the default prefix.

Removing Category by Adding a Code in functions.php File

 

Another way to remove a category from a WordPress URL is by typing in a code in functions.php.

This option will not work if you have already modified the category base settings and replaced or removed the word 'category' from your URL slug.

In order to add the code, follow this process:

  • Go to your WordPress dashboard.
  • Select Appearance >> Theme Editor.
  • Find ‘functions.php’.
  • Type the following code before the last PHP tag:
  •  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);

Using Yoast's SEO Plugin to Remove Category from WordPress URL

 

Yoast SEO is a search engine optimization plug-in for WordPress. It comes with many useful features.

One of the many functions it offers is the possibility to help you remove the category prefix. So if you're already using this plugin, this may be another easy way to customize your URL look, without adding or changing any code.

Before you use this procedure, make sure that you haven't modified the Category Base settings in permalinks.

Follow the steps below to take the category prefix out:

  • Go to your WordPress dashboard.
  • Select Yoast SEO >> Search Appearance>> Taxonomies
  • Go to Category URLs and select ‘Remove the categories prefix’.
  • Save the changes.

Modifying .htaccess to Remove Category From WordPress URL

I'm interrupting the article to tell you about BeTheme, the definitive multipurpose theme. If trying to satisfy multiple clients has become more stressful than rewarding, BeTheme has a solution for that.

BeTheme’s selection of hundreds of customizable, responsive pre-built websites is the highlight and a proven stress reducer.

The customizability of the theme makes it a dream come true for its users. There are 4 types of Page Builders that you can use with it: WPBakery, BeBuilder, and Elementor among them.

And now with the Live Builder, it’s even more impressive.

Check out BeTheme and see why our users love it!

The rest of the article is down below.

 

Besides using a plugin or any of the other options mentioned earlier, you can also remove the category prefix by adding a code to your .htaccess file.

You can access the file either via FTP or cPanel. If you can't find the .htaccess file, check if your file manager is set up to show hidden files (dotfiles).

Here are the instructions:

  • Go to your .htaccess file.
  • Add the following code after the closing tag in the file:
  •  
    RewriteRule ^category/(.+)$ http://www.site.com/$1 [R=301,L]
    
  • Write your domain name in place of www.site.com in the code above.
  • Upload it on your server's public_html directory.

Using the Remove Category URL Plugin

 

The next option you have when trying to modify your URL slug is the Remove Category URL plugin.

This plugin completely removes the category prefix. It's easy to use and doesn't require any configuration. It also redirects old category permalinks to the new ones.

However, before installing more plugins, try another method first. Some plugins can negatively affect the loading speed of your site.

If you decide to install this tool, these are the steps:

  • Go to your WordPress dashboard.
  • Select Plugins >> Add new
  • Type ‘Remove Category URL’ in the ‘Search plugins’ box.
  • Click on ‘Install now’.
  • After it has been installed, click on ‘Activate’.
 

Another plugin that can assist you with removing the category prefix is FV Top Level Categories. It is simple to use and light on code. It automatically redirects old category permalinks to the new ones.

FAQ on how to remove the category from the WordPress URL

Why is it important to remove the category from the WordPress URL?

Removing the category improves URL readability and SEO. Cleaner URLs are easier for both users and search engines to understand, which enhances site indexing and visibility. This affects user experience positively and could improve page rankings.

Can removing the category base affect my website's SEO?

Yes, it can positively impact SEO. Streamlining your URL structure by removing unnecessary categories can make your URLs more SEO-friendly. This simple change helps search engines crawl your site more effectively, potentially improving your search engine rankings.

What steps are involved in removing the category from WordPress URLs?

The process typically involves updating the WordPress permalink settings. You can set the category base to ".", which effectively removes it. For a more robust solution, editing your site’s .htaccess file or using a plugin like Yoast SEO can achieve the same result more efficiently.

Are there any risks to removing the category from URLs?

While the benefits are clear, there's a risk of generating broken links if not done properly. Ensure you set up proper redirects to maintain link integrity. Always back up your website before making such changes to avoid any potential issues with lost data or functionality.

What plugins can help with removing the category in WordPress URLs?

Plugins like Yoast SEO and Remove Category URL are excellent for this. They provide user-friendly interfaces that handle changes without needing to manually edit permalink settings or .htaccess files. These plugins also often come with additional features to boost your site's overall SEO.

How does removing the category from URLs enhance user experience?

Shorter, cleaner URLs are easier to read, remember, and share. They convey a sense of organization and clean URL management that users appreciate, leading to a better user experience and potentially lower bounce rates as visitors find the website more navigable.

Do I need to know coding to remove the category from the WordPress URL?

Not necessarily. While you can edit the .htaccess file for a manual fix, many plugins provide a no-code solution where you can tweak your SEO URL optimization settings through a graphical user interface. This makes the removal accessible to those without coding knowledge.

What is the best practice for removing categories from WordPress URLs?

The best practice is to use a reliable plugin or correctly configure your .htaccess file to permanently redirect the old URLs to the new format. Ensuring that all links lead to the correct URLs without categories prevents SEO penalties and preserves user engagement.

Setting up 301 redirects is crucial. This permanent redirect tells search engines and users' browsers that a page's URL has changed permanently, directing them to the new URL without a category. This maintains SEO equity and prevents 404 errors, which can detract from user experience.

Can removing the category base affect my WordPress site's performance?

If implemented properly, removing the category base can actually improve site performance. Cleaner URLs simplify the site architecture, which can lead to faster site indexing by search engines and quicker loading times for users, enhancing the overall site performance.

Conclusion

As we wrap up our dive into how to remove the category from the WordPress URL, it's clear that the impact stretches far beyond just aesthetic enhancements of your site's links.

  • SEO optimization skyrockets as cleaner URLs align better with best practices, making your site more crawl-friendly for search engines.
  • Improved user experience comes from streamlined navigation, leading to enhanced site interactions and longer visitor sessions.

Effectively implementing these changes involves utilizing tools like Yoast SEO, which can automate the process and ensure consistency across your website’s architecture without needing deep technical expertise.

Remember, the ultimate goal is to create a digital space that feels intuitive and is easily discoverable. Just like organizing a bookshelf makes finding books easier, organizing your URLs enhances the findability of your content. Here’s to cleaner URLs, better SEO, and a superior user experience!

If you enjoyed reading this article on how to remove categories from WordPress URLs, you should check out this one about fixing the destination folder that already exists.

We also wrote about a few related subjects like WordPress posting to Facebook, how to reorder pages in WordPress, fixing the inability to save the password reset key to the databasefailing to load resources, fixing the other update that is currently in progress, how to revert WordPress to the previous version and how to add a button in WordPress.

Albert Ślusarczyk
Albert Ślusarczyk
As the co-creator of Be Theme, I am a strong believer in designing with care and patience. I pour my energy, time & knowledge into perfecting the theme for our 260,000+ customers.
Siteground Hosting