Permastructures

Permastructures act as templates for custom permalinks in the Permalink Manager plugin. They play a key role by giving you control over how URLs should look like for new content items.

This is because they are involved in generating the custom permalink whenever you publish a post or add a term. For URLs that already exist, changing the settings will not update them automatically.

This helps prevent accidental changes to links that may already be in use or ranked in search engines. Still, if you would like old URLs to follow the new structure, you can use the "Regenerate/reset" tool to do so.

How to Edit Permastructures?

To make changes to permalink formats, first log in with admin account and open your WordPress dashboard. Once in the dashboard, in the menu on the left-hand side, select "Tools" and click on "Permalink Manager".

Then click on the "Permastructures" tab to adjust or simply preview the settings. Initially, it will show the original permalink formats that existed prior to enabling the plugin. You can keep these settings unchanged or customize them for specific content types.

For instance, you can use them to e.g. add custom fields or remove the rewrite base from permalinks.

Permastructures section
Every post type and category uses its own permalink format, which you can adjust as needed if the original one does not meet your needs.

Available Tags

Within the settings fields, it is possible to add static text or dynamic tags like %category% if you want to include elements that change, like the slug from a related category.

To find out which tags you can use, click on “Available tags” to view a list of them compiled for each of content types.

Available tags

Available tags for permalink formats

How to Preview New Custom Permalink Format?

If you are not certain that your new "permastructures" settings are correct, try opening the sample post and inspecting the URL in the "URI Editor". The default URL, based on your updated permalink format from the "Permastructure" settings, will appear in the "Default custom permalink" row.

How Permastructures affect single permalinks
Custom permalink” field shows the current canonical permalink.
The “Default custom permalink” field indicates the default format of the custom permalink based on “Permastructure” settings.

How to Update Existing Custom Permalinks?

By default, the Permastructures only control the custom permalinks for new content items. Therefore, changing them does not automatically update of your existing content URLs. To apply those changes to existing permalinks, the most straightforward method is to use the "Regenerate/reset" tool.

To sum up, whenever the plugin generates & saves custom permalinks, it relies on Permastructures and this happens in three specific situations:

  1. When a new post, page or term is published
  2. When URLs of existing items are manually regenerated using the "Regenerate/reset" tool
  3. When the "auto-update" mode is enabled, and an existing post, page or term is updated or saved

Tips

The native slugs are generated from the initial title and will not update automatically if the titles are changed later. By default, custom permalinks include the same native slugs as the original permalinks.

The plugin gives you the option to replace slugs with the post title using the %native_title% tag, or to remove the slug altogether.

Native title

If you want to use the actual titles for all custom permalinks, a simpler option than using the %native_title% tag is to adjust the global slug settings.

Slugs modePermalink Manager, like WordPress, will use native slugs by default. In the plugin setting ("Slugs mode" field) you may decide whether either native slugs or actual post titles should be included when new permalinks are generated.

"Slugs mode" field

How to Replace the Slugs With Post/Term IDs?

You can use Permalink Manager to add element IDs to custom permalinks by using dedicated tag: %post_id% for posts and %term_id% for terms. However, if you want to use it to totally replace the slug, you will need to do a few further steps.

To begin, you must activate the "Do not automatically attach the slug" option attached to permastructure settings in order to use post/term IDs instead of slugs. Furthermore, you will need to use extra code snippet to help Permalink Manager recognize URLs with numeric endings and separate them from lookalike pagination endpoints.

add_filter('permalink_manager_deep_uri_detect', '__return_true');

Once it is done, you should adjust the permastructures settings and use %post_id% tag

How to add post ids to custom permalinks?

How to Conditionally Change Permastructure Formats?

As previously stated, Permastructures are a key component of the plugin, allowing you to specify the way your custom permalinks look like. The plugin lets you pick a single global format through its interface. For more advanced use, you can enhance this by using code to update the format dynamically as needed.

You can override the default permastructure and extend its behavior by using the ' permalink_manager_filter_permastructure ' filter. This filter lets you apply custom logic and modify custom permalinks dynamically, depending on certain conditions when the plugin processes them.

For example, if you use this filter with the 'has_term()' function to build a code snippet, you can alter the permalinks of a post based on the category it is assigned to:


>/** * How to programmatically modify post permalink formats (permastructures) * * @param string $permastructure The permastructure string used when default custom permalink is generated. * @param WP_Post|WP_Term $post Post or term object * @return string The new, filtered permastructure string used when default custom permalink is generated (for new posts or existing ones if "Regenerate/reset" tool is used) */ function pm_filter_post_permastructure($permastructure, $post) { // Filter only 'Post' permalinks if(empty($post->post_type) || $post->post_type !== 'post') { return $permastructure; } // A. Post assigned to either 'Category A' or 'Category B' if(has_term(array('Category A', 'Category B'), 'category', $post)) { $permastructure = '%category%/%postname%'; } // B. Post assigned to other categories else { $permastructure = '%year%/%monthnum%/%day%/%postname%'; } return $permastructure; } add_filter('permalink_manager_filter_permastructure', 'pm_filter_post_permastructure', 10, 2);

The code above is just a basic example. For further information and examples, please visit a dedicated page.

Frequently Asked Questions

Why Is the Slug Automatically Appended?

By default, Permalink Manager will add slugs to custom permalinks if there is no slug tag (e.g. %postname%) in the Permastructure settings. To turn off this feature, you can disable it in the Permastructure settings by selecting "Do not automatically append the slug" after clicking on the "Show additional settings" button.

"Do not automatically append the slug"

If you would like to manually tweak the custom permalinks, you can use the Bulk URI Editor. The items are grouped by post type and taxonomy for your convenience.

Bulk edit permalinks using URI Editor

 

Last updated by Maciej Bis on: July 11, 2025.


Maciej BisFounder of Permalink Manager & WordPress Developer

The developer behind Permalink Manager, a plugin for managing permalinks, has been working with WordPress, creating custom plugins and themes, for more than a decade.

Go up