We have used previous blog posts to discuss foregoing plain WordPress URLs in favour of long name URLs that include the name of the page or post. This is a good practice in as much as long name URLs are more SEO friendly. Yet WordPress offers another option that could both boost SEO performance and make it easier for you and your readers to keep track of your posts.
The option we’re talking about is the one that allows you to create custom URLs. You can see this option by logging in to your WordPress Dashboard, then navigating to Settings>Permalinks. In a new page that opens, you will see the six URL options:
- Day and name
- Month and name
- Post name
- Custom Structure.
You can use the Custom Structure option to create URLs that include your post categories and subcategories. We outline the process below.
Step #1: Create Categories
WordPress comes with a single default category out-of-the-box. If you want categories in customized URLs to be effective, delete the WordPress default and create your own categories and subcategories. Please bear in mind that any post published under multiple categories will not show all those categories in the URL. WordPress will only display one category, according to alphabetical order.
Step #2: Create Your Custom Structure
The second step is to go back to the Permalink settings and create your custom structure. Tick the circle next to the ‘Custom Structure’ option and then enter the URL format into the dialogue box. It would look something like this:
The above example would display both category and subcategory in the URL. The last parameter – post name – could be something else. You can use the month and name, day and name, etc. instead. We recommend going with the post name in order to take maximum advantage of categories and subcategories.
Step #3: Apply Categories to Posts
If you have already been categorizing your posts all along, you can skip this step. If not, you’ll have to edit each of them to assign their categories. Every new post you create in the future should be assigned a category at the time it is published.
More about Categories and Subcategories
The strategy of including categories and subcategories in your URLs can backfire if you’re not careful to make sure that every new post is correctly assigned a category. Here’s why: WordPress automatically assigns a default category to new posts if you don’t do it. This could mean the URLs for your posts not being generated accurately.
Also note that if you include both the category and subcategory strings in your custom URL, and you select a subcategory for a new post, WordPress automatically uses its parent category in the URL. If you have subcategories with identical names assigned to two different parent categories, you have to designate the parent category you want or WordPress will default to the one that comes first in alphabetical order.