Slugs mode

In Permalink Manager settings you can select how the default permalinks should be generated for new posts and terms.

You may change this in the plugin settings and selecting one of the three available options in the "Slugs mode" field. Each of them is discussed in depth in the sections that follow.

Slugs mode
The slugs mode can be set in Permalink Manager settings.

The "slugs mode" determines how the default permalinks are generated for new content. Whichever mode you choose, these adjustments apply to the default permalinks. Any of the custom permalinks can be overwritten and adjusted whenever you need to.

The default permalinks mentioned in this article are used only for the new posts & terms permalinks. To apply the new permalink formats to existing items please use "Regenerate/reset" functionality.

Available settings

Use native slugs

The native slugs are used by WordPress in posts' and terms' original permalinks. They are generated after the post or term is published. Please note that the slug remains unchanged even if you change the post/term title.

Title Native slug Native permalink
(slug is added to the end of URL)
Volvo XS60 volvo-xs60 http://example.com/car/volvo-xs60
SUVs suvs http://example.com/cars/suvs

Basically, the native slugs are used to identify the posts/terms when they are stored in the database. What is more important, they are also used in the native permalink system. WordPress parses the slug from requested URL and uses it to detect what post/term should be loaded.

WordPress slugs
Check out a separate article if you do not know what "slug" means or how WordPress slugs are used to build permalinks.

In short, when you keep "Use native slugs" mode selected, Permalink Manager will use the same slugs as WordPress does for the default permalinks.

Use actual titles as slugs

Permalink Manager does not rely on the native permalink system. The posts/terms URLs are treated differently. As I mentioned above, WordPress uses the native slug to detect what content should be loaded. Permalink Manager uses the full URL address instead.

Permalink Manager, unlike the built-in permalink system, will recognize your customized URLs as long as they are unique as a whole. It makes no difference whether they include native slugs or not. This is possible because the plugin stores statically in the database the full permalinks allocated to their IDs.

In light of the foregoing, you may have Permalink Manager use the actual titles rather than the native slugs when creating new custom permalinks. To use this functionality, just choose "Use actual titles as slugs" in the "Slugs mode" option box in Permalink Manager settings.

Use actual titles as slugs

In the following example, you can see precisely how this works. By default, the permalink had the native slug 'johnny-doe' however in this mode it contains the actual title 'john-doe'.

Use titles in WordPress permalinks
In "Use actual titles as slugs" mode, the plugin will automatically use for the default permalink the actual title – “Johnny Doe” (johnny-doe) instead of the native slug (john-doe).

Another illustration of the difference between a native slug and a slug created from a title may be found in the table below. The the native slug is replaced with actual title not only for the specific page/term but also for its parents (see last column).

Title & hierarchy Native slug Original permalink
("Use native slugs")
Custom permalink
("Use actual titles as slugs")
Europe
(Top-level)
european-countries http://example.com/regions/european-countries http://example.com/regions/europe
EU
Europe -> European Union
european-union http://example.com/regions/european-countries/european-union http://example.com/regions/europe/eu
Scandinavia
Europe -> European Union -> Scandinavia
scandinavia http://example.com/regions/european-countries/european-union/scandinavia http://example.com/regions/europe/eu/scandinavia

This functionality could be also very helpful if you would like to use the same slug in more than one permalink. You can use the same slug more than once, but still you need to make sure that the full URL address is unique.

Title Native slug Original permalink
("Use native slugs")
Custom permalink
("Use actual titles as slugs")
Cotton T-shirt cotton-t-shirt http://example.com/shop/men/cotton-t-shirt http://example.com/shop/men/cotton-t-shirt
Cotton T-shirt
(Duplicated title)
cotton-t-shirt-2 http://example.com/shop/women/cotton-t-shirt-2 http://example.com/shop/women/cotton-t-shirt

Inherit parents' slugs

This mode will be useful, if you would like make the child categories or pages inherit the permalink of their parent after it is manually adjusted.

Title & hierarchy Original permalink Adjusted permalink
Apparel http://example.com/shop/apparel http://example.com/top-clothes
Women Apparel -> Women http://example.com/shop/apparel/women http://example.com/top-clothes/women
Jackets Apparel -> Women -> Jackets http://example.com/shop/apparel/women/jackets http://example.com/top-clothes/women/jackets

As you can see on above example, the custom permalink for top-category was changed from: shop/apparel to top-clothes. If inherit parents' slug mode is enabled, the default permalinks for child categories will be also affected.

Please note that after you change the parent permalink, the children permalinks will not be automatically updated. The new parent permalink will be inherited only by new terms and pages. For example, if you already have a structure of pages in a parent-child relationship and you change the parent's slug - you will still need to regenerate their permalinks. You can do so in Tools > Permalink Manager > Tools > Regenerate/Reset section.

Must be remembered that during the regenerate process your manual changes to parent permalinks can also be overwritten.

To prevent this from happening, you need to exclude parents permalinks to make Regenerate/Reset tool ignore them. As shown below, in URI Editor you should select "No (ignore this URI in bulk tools)" option in "Auto-update the URI" option field.

Auto-update WordPress URLs

How can the slug mode settings be modified programmatically?

If necessary, you may overwrite the global settings and make the plugin use actual titles rather than slugs exclusively for only certain post types and taxonomies. The same filter may be used to both content types. Please use one or both snippets depending on which one you wish to change (post type or taxonomy).

/**
* @param int $mode      	Set '1' to use actual titles, set '0' to force the default settings and use the native slugs in the custom permalinks.
* @param string $slug      	The native slug
* @param WP_Post|WP_Term $object      	Post or term object
* @return int			The slug mode. 
*/
function pm_term_use_title_instead_of_slug($mode, $slug, $object) {
return (!empty($object->taxonomy) && $object->taxonomy == 'product_cat') ? 1 : $mode;
}
add_filter('permalink_manager_force_custom_slugs', 'pm_term_use_title_instead_of_slug', 9, 3);
function pm_cpt_use_title_instead_of_slug($mode, $slug, $object) {
return (!empty($object->post_type) && $object->post_type == 'cpt_name') ? 1 : $mode;
}
add_filter('permalink_manager_force_custom_slugs', 'pm_cpt_use_title_instead_of_slug', 9, 3);
Go up