Use the same permalink base for different post types/taxonomies

In general, using the same permalink format for multiple content types in WordPress is not possible. This might be a major issue, particularly if you want to apply the silo schema to your permalink structure. You can easily solve this issue using Permalink Manager, regardless of how you want your permalinks to be structured.

Some of the functionalities presented in this article are not available in free version (Permalink Manager Lite). Buy Permalink Manager Pro

At first look, the idea of original permalink bases and rewrite rules may seem confusing. To begin, WordPress uses predefined, simplified formats to identify the content type from requested URL address, hence reducing the number of database requests. If they are not unique for each content type, WordPress will be unable to detect URL and load a proper post or term.

In other words, when a visitor attempts to access a page, WordPress compares the requested URL to an array of rewrite rules, which is actually a set of permalink format patterns. If the requested permalink matches any of these, WP will convert the URI into a database query, load the appropriate template file, and deliver the page or return a “not found” error.

One issue that emerges here is that certain rewrite rules (permalink formats) take precedence over others. Furthermore, when WordPress reads the URL, it does not care whether the post, page, or term exists; it simply has to match the permalink format with possibly the greatest priority.

Take a look at the example below. If you use the same rewrite slug for both products and product categories permalinks, WordPress will treat any URLs starting with “/shop/” as product category permalinks. As a result, whenever a visitor accesses any product page, WordPress will attempt to load a product-category page that does not exist.

“Product category” permalinks (WordPress detects them correctly)

http://example.com/shop/clothing
http://example.com/shop/clothing/men
http://example.com/shop/clothing/women

“Product” permalinks (WordPress sees them as product categories and returns 404)

http://example.com/shop/amazing-plain-t-shirt
http://example.com/shop/beautiful-white-cotton-dress

To cut a long tale short, Permalink Manager allows you to set the same rewrite base/slug for different content types since it does not use rewrite rules (regular expressions) to detect the content. To be specific, it identifies posts and terms based on their complete custom permalinks rather than their slugs. The plugin can easily detect them as long as you keep the permalinks unique as a whole.

Below is a basic case study, but you may take it as an example and mimic it in any more sophisticated permalink structure. We have one custom content type and two taxonomies (one hierarchical and one non-hierarchical) available, as shown below. For each content type, the rewrite slug (“car“, “manufacturer“, “transmission“) parameter is unique.

http://example.com/cars/fiesta-2015
http://example.com/cars/s40-2017
http://example.com/cars/m5-2016

http://example.com/manufacturer/ford
http://example.com/manufacturer/volvo
http://example.com/manufacturer/bmw

http://example.com/transmission/manual
http://example.com/transmission/automatic

Our objective is to apply the same base (“cars”) for the permalink of all three content types:

http://example.com/cars/ford/fiesta-2015
http://example.com/cars/volvo/s40-2017
http://example.com/cars/bmw/m5-2016

http://example.com/cars/ford
http://example.com/cars/volvo
http://example.com/cars/bmw

http://example.com/cars/manual
http://example.com/cars/automatic

Change the Permastrucutres settings

Permastructures
If you’re not sure how to use permastructures editor, please read this article.

The first step is to change the permastructure settings. To do so, go to the admin section “Tools -> Permalink Manager -> Permastructures. You may simply modify the permastructures of all custom post types and taxonomies as shown below. We will use the same permalink base for all of the content types mentioned in this example.

cars/%car% cars/%manufacturer%/car%
manufacturer/%manufacturer%cars/%manufacturer%
transmission/%transmisson%cars/%transmission%

Please remember to save your changes after adjusting the settings by clicking the “Save Permastructures” button at the bottom.

New permalink formats in Permastructure settings

After you configure the permalink formats with new bases, Permalink Manager will use them in all new post and term permalinks. You will need to regenerate their permalinks if you want to update them in old elements as well.

Regenerate/reset tool
The existing custom permalinks will not be automatically updated if you change the permastructures. You will need to use the “Regenerate/reset” tool to apply the new URL format to them.
Go up