How to include categories and subcategories in WordPress URLs

Categories and subcategories allow you to organize content on your website, so your readers can quickly find what interests them. Sometimes you might want to have the category and a subcategory in the URL, such as https://yoursite.com/news/international/politics-today. In this example, news is the category, and international is a subcategory. Including categories and subcategories in the WordPress URL is a good idea for a couple of reasons:

  1. A clean URL. This helps people understand the context of the article from the URL itself. For example, a user can quickly know that the article points to the international news on your news website from the above URL.
  2. Search engine optimization. Your site gets better hits and visibility in Google and other search engines for relevant keywords.

The default WordPress URL structure does not include the category and subcategory, and here’s how you can modify the structure to include them.

  1. Log in to your HostPapa Dashboard
  2. Click My WordPress.

my-wordpress

3. In Applications, select WordPress Manager.

wordpress-manager

4. The WordPress Manager will open with a list of your domains. Locate the domain you want to edit and click Manage.

5. On the WordPress admin page, click on Settings.

6. Click the Permalinks page from your WordPress menu.

7. Click on the Custom Structure option under the Permalink Settings

8. Enter the /%category%/%postname%/ in the field next to the Custom Structure

9. Click on Save Changes. WordPress will now start adding categories and subcategories

10. To see this in action, create a new post and assign it a category and a subcategory. Once you do this and save the post, you’ll be able to see the category and subcategory inside the URL.

How to use multiple categories/subcategories

If you categorize your blog posts into multiple categories or subcategories, WordPress does not pick them all up for the URLs. It will only pick up one category and one subcategory for the URL. In case there was no subcategory chosen, then it will show the parent category.

WordPress selects categories alphabetically. For example, if you have an article filed under Google, Technology categories, the URL would be
https://yoursite.com/google/google-launches-new-device

However, if you filed under Google, which had a Technology subcategory, then the URL would be https://yoursite.com/google/technology/google-launches-new-device

If you selected a subcategory but did not specifically select a category, WordPress will automatically put the parent category in the URL.

It can be possible that you selected a category, subcategory, and sub-sub-category for an article. In this case, WordPress would include the category, subcategory, sub-sub-category to the URL as well, such as https://yoursite.com/google/technology/devices/google-launches-new-device

Using detailed categories and subcategories in URLs is an excellent way to enhance the readability of the URL, as well as increase SEO for your website.

If you need help with your HostPapa account, please open a support ticket from your dashboard.

Related Articles

Get online with our affordable web hosting

Get online with our affordable web hosting

Learn more now
HostPapa Mustache