Logo

How to Remove a Category From My WordPress URL

Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on google
Share on whatsapp

As I am sure that you know, WordPress is a CMS (Content Management System). WordPress is used to create and publish articles and media for blogs and websites. It has become a top-rated platform with millions of users. As of Spring 2021, it has been calculated that more than 40% of the top ten million websites are built on WordPress. Now that is incredible market penetration.

One of the features of WordPress is that it has the option of adding various categories to a website. Each category is allocated a “category page” and a separate RSS feed. You can view any posts assigned to a category by visiting the category page for that topic.

Out of the box, WordPress will add “category” as the standard prefix for all of the category pages. This makes it clear that they are categories and not posts/pages.

For example, if you had a motoring website and one of the categories was “Trucks“, then the URL for that category would be http://motoring.com/category/trucks/.

Typically, there is no need to remove the prefix “category” as it is a valuable way of explaining how your website is organized. That said, there are times when you may prefer to remove the prefix from the URL, and this is what we will discuss in this article.

Reasons to Remove Category from WordPress URL

Generally speaking, it is a bad idea to remove the category prefix from your WordPress website, as it not only assists users to understand your website structure and provides pointers to search engines. So only remove this prefix if there is a perfect reason, such as the following. 

SEO Reasons

As a webmaster, your target has to produce an SEO friendly URL, which only contains optimized keywords. These keywords should be easy to understand by both humans and search engines. It may be that the category can detract from this target.

 

 

 

Let’s go back to our example website on motoring. By default, an article in the category trucks would have the following URL:

http://motoring.com/category/trucks/ 

 

 

 

If we were to remove the category prefix, the WordPress URL would look like this:

http://motoring.com/trucks/ 

 

 

 

This is clearly more focused and will produce better SEO results. However, we should also point out that there may be disadvantages to removing the category prefix. 

 

 

 

  1. A problem can occur if they have a category and a page with the same name. This can cause an infinite redirection loop, and the page will be unable to load.
  2. If you are using %postname% as your WordPress URL structure and have a category of the same name as the post, this can also produce the same infinite loop scenario.

Personalizing a Category Prefix

When creating a website, the term category may not be ideal for describing groups of posts. Say, for example, you have a website that is posting news items, you may feel that using the term “Articles” would be more appropriate than using the term “Categories”. In cases such as this, you may want to charge the base prefix.

 

 

 

An associated issue is when you are happy to have a category prefix, but you would prefer another term than” category.”

It is quite possible to change the term “category‘ to any other one of your choosing. This may be, for example, “Article“,” Topic“, or something more specific to your website, such as “Tutorials.”

 

 

 

In our example from above, the edited WordPress URL when using “articles” would be:

http://motoring.com/articles/trucks/ 

 

 

 

You can make modifications to the term “categories” in the WordPress Dashboard Settings section.

Settings >> Permalinks >> Optional >> Category base

Change the term to the one you wish to use and then press “Save.”

Changing Your WordPress Permalinks Settings

What is a Permalink?

A permalink is the section of a web address that follows the domain name. When your permalinks are being used correctly, they fulfil certain functions: 

  1. They allow the website visitor to indicate what the page is about from the words used in the permalink.
  2. They assist search engines in finding pages related to a topic.
  3. They also provide a permanent address that can be remembered by the visitor, so a later return is possible.

 

 

 

What is the Default Setting?

When WordPress is set up, it sets the permalinks by default to “day + name.” As soon as you have completed the installation of WordPress, it is essential to reset the selection to the one that is most appropriate to your needs. Many people find that choosing “Post name” offers the best results as it makes it very clear what the page or post is about.

 

 

 

Changing the Permalink Structure when you are installing WordPress is just making your selection before you start adding posts or pages. It really is simple. Using the WordPress dashboard go to Settings >> Permalinks and make your selection, then save it.

 

 

 

Clearly, It is really a lot better to make changes to this setting BEFORE you start adding Pages and Posts to a WordPress website. Whilst you can change this at a later stage, doing so can break your website. So, think carefully about how you want URLs to look at the planning stage of the site immediately after you have installed WordPress.

 

 

 

Editing the permalink settings on the website after publication is a significant change to the site and should only be done after a great deal of thought.

 

 

 

Every page or post on your website has a URL that is unique and has been permanently assigned. What the URL looks like depends on the “Permalink Settings” in the WordPress dashboard. Editing this setting can produce the following issues:

 

 

 

  1. Search Rankings
  2. Outdated links from external websites.
  3. Broken internal links on your own website.

Removing the Category

METHOD 1 – Remove Category in WordPress Permalinks

 

 

 

Using this method, it is possible to eradicate the category prefix. This is done by making changes to the WordPress permanent link. This method involves five steps and is easy to do:

 

  1. Go to the WordPress Dashboard.
  2. Select Settings >> Permalinks.
  3. Go to “Custom Structure” and enter “/%category%/%postname%/.”
  4. Go down the page to category base and enter a full stop.
  5. Save the changes that have been made.

 

 

 

METHOD 2 – Adding code in the “functions.php” file to Remove the Category.

 

This second way to remove the category is a little more complex, and beginners may find it intimidating. Also, this option cannot work if you have already removed the word “category” from your WordPress URL or slug. 

Do not do this if you feel concerned about entering code.

 

 

 

  1. Start at your WordPress Dashboard.
  2. Choose Appearance >> Theme Editor.
  3. Find the file named “functions.php” and open it.
  4. Left Click just before the last PHP tag. 
  5. Copy the following excerpt of code – 

“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);”

  1. Right-click and select “Paste”.
  2. Save the changes made and close the windows.

 

 

 

METHOD 3 – Plugins 

Two plugins can be used to remove the category from the URL. You will first need to install the plugin of your choice and then follow the instructions below.

Yoast SEO Plugin

Yoast SEO plugin has several options. One of them is to remove the category prefix. This method does not require editing or adding new code to files, so it may be easier for some users. Once again, you must not have changed the Category base in the Permalinks section.

 

 

 

Procedure

  1. Start at the WordPress Dashboard
  2. Select Yoast SEO >> Search Appearance >> Taxonomies.
  3. Go to Category URLs and choose “Remove the category prefix.”
  4. Save the changes.

 

 

 

Remove Category URL Plugin

As the name suggests, the plugin is designed for the specific purpose of removing the category prefix. Thus, it does not require any setting-up, and as a bonus, it will also redirect any old permalinks to the updated choice.

 

 

 

Procedure

  1. Go to your WordPress dashboard.
  2. Install the plugin.
  3. Activate the plugin.
  4. Once activated, it’s done, nothing more to do.

How Do I Automatically Redirect People from My Old Category Permalink?

The best solution for this problem is to use the Redirection plugin, adding your old and new category links.

Final Thoughts

We have given you a selection of choices for methods to remove and amend the Category prefix. Of course, some ways are easier than others, and you should select the most appropriate process for your level of skill and the results you want to achieve.

 

 

 

Think carefully about how any change will reflect on your SEO results and whether it will cause broken links from external sites.

 

 

 

WordPress is an excellent tool for creating websites and understanding all of the features, ultimately making a lot of sense. However, understanding when and how to make changes to the Permalinks setup is essential and can impact your website’s performance.

We hope that this article has been helpful.

Leave a Reply

Your email address will not be published. Required fields are marked *