Recently, one of our readers asked us: How to include a category and a sub-category in WordPress URLs?

Categories and subcategories allow you to sort the content on your website. They also allow your users to easily browse the topics that interest them the most. To be complete, discover our tutorial on How to assign categories to your WordPress pages

In this tutorial, we will show you how to include a category and a subcategory in WordPress URLs.

And if you have never installed WordPress, discover How to install a WordPress blog in 7 steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

Why include subcategories in URLs?

WordPress comes with two default taxonomies to sort your content. These are categories and labels.

Categories are generally used for larger topics and may have subcategories. 

However, if you use the default value of the structure of permalinks of WordPressyour categories and subcategories will not be included in article URLs.

See also How to use categories and labels effectively on WordPress

Some websites use categories and subcategories in the WordPress URLs of their posts and others use subcategories to display both parent and child category of posts.

http://example.com/actualite/wordpress/titre-de-larticle/

In this example, "news" is the parent category and "wordpress" is the children category.

Including the category and subcategories makes the links of your articles more user-friendly. This corresponds to the navigation in " breadcrumb On your website and this includes more keywords and text, which is helpful for the SEO

We also invite you to consult How to convert categories to taxonomies on WordPress

That said, we'll see how to easily add the category and subcategories in WordPress URLs.

How to include categories and subcategories on URLs

First of all, you must visit " Settings> Permalinks In your dashboard. You just have to click on the option " custom structure In the common parameters area.

Then you need to add /% category% /% postname% / in the field next to the custom structure.

After that, do not forget to click on the button « Save settings To save your configurations.

 How to add categories to the menu of your WordPress blog ? Check out this article and leave us your impressions.

That's all, WordPress will now start showing categories and subcategories. You can see it in action by editing an article or creating a new article.

How to use multiple categories at the same time

Suppose you add your articles in multiple categories or subcategories. WordPress will only display a category and a subcategory in the URL. If you don't choose a subcategory, then it will only show the parent category.

See also How to add categories and tags in WordPress Media Library

WordPress chooses the category in alphabetical order. For example, if you add an article in the categories " Apple Lossless Audio CODEC (ALAC), And in the category " Technology Then WordPress will show " Apple Lossless Audio CODEC (ALAC), In the URL because it comes first in alphabetical order.

http://example.com/apple/titre-de-larticle/

If you drop an article in "Apple" and a subcategory called "Technology", then it will include both in the URL.

http://example.com/apple/technologie/titre-de-larticle/

If you selected a subcategory, but didn't specifically choose the parent category, then WordPress will always include the parent category. 

Another case is when you have a parent category, a sub-category, and a sub-sub-category. WordPress will display the 3 categories in the URL.

http://example.com/apple/technologie/evenements/titre-de-larticle/

So, from now on don't forget to configure your permalinks for a display that corresponds to what you want.

Discover also some premium WordPress plugins  

You can use other WordPress plugins to give a modern appearance and to optimize the handling of your blog or website.

We offer you here some premium WordPress plugins that will help you do that.

1. WP Media Manager

Le WordPress Plugin Media Manager gives you options to organize your media library in the easiest and fastest way.

Drag, drop, customize, order, filter, create and duplicate your WordPress library's media files and folders in the most convenient way with this WordPress Plugin premium.

It is a plugin that sorts and answers all your needs for managing multimedia files and folders in WordPress. It's so powerful that it lets you organize thousands of media files with drag and drop functionality. Just drag and drop to complete the insert feature.

Download | Demo | Web hosting

2. FAT Image Gallery 

FAT Gallery is a WordPress Plugin which allows you to create image grids on WordPress. With 5 main styles: masonry, justified, album, carousel and grid, Fat Gallery is certainly one of the most adjustable plugins for creating image galleries on WordPress. 

Its other features are: a responsive interface, customization of image, font, spaces, and hover effects, 5 main types of gallery, support for 5 shortcodes to display galleries, support for Visual Composer and more.

Download | Demo | Web hosting

3. Embed Any Document Plus

Embed Any Document Plus is a very useful WordPress plugin that allows you to display any document hosted on DropBox on your website.

It allows you to use Google Docs and Box.Com files in your website. Like any popular website, this plugin will help you integrate documents without any other external tool.

Download | Demo | Web hosting

Other recommended resources

We also invite you to consult the resources below to go further in the grip and control of your website and blog.

Conclusion

Here ! That's it for this tutorial. We hope that it will allow you to display categories and subcategories in WordPress URLs. If you have any questions, please do not hesitate to ask us. share the tip with your friends on your social networks.

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.

But in the meantime, tell us about your Comments and suggestions in the dedicated section.

...