Permalink Manager generates and saves custom permalinks for all public content types and taxonomies. If you would rather not use custom permalinks for them, you have the option to exclude certain content types or individual posts/terms by their IDs in the plugin settings.
These modification options let you create customized permalink formats for content types that need complex URL structures. For instance, you may apply these formats just to WooCommerce permalinks (products, product categories, and tags) while preserving all other WordPress URLs.
In order to use this feature, go to the plugin's settings and choose the "Exclusion settings" section, where you will find the various configuration options outlined below.
Exclude content types
To choose which custom post types and taxonomies should be ignored by the plugin, go to "Tools -> Permalink Manager" and click on the "Settings" tab. In the "Exclusion settings" section, you will find the "Exclude content types" field. Select all the content types whose permalinks you do not want to be changed by Permalink Manager.
"Exclude content types" strict mode
Since the 2.2.20 version, Permalink Manager ignores custom post types and taxonomies that have both the "query var" and "rewrite" properties set to false. This modification was done primarily to prevent the plugin from saving custom permalinks for content items that are not supposed to have their own public URLs.
If you need to employ them for whatever reason, please make sure that the ""Exclude content types" strict mode" option is turned off in the options. As a result, the content types that are excluded by default will appear in the "Exclusion settings -> Exclude content types" field.
How to remove excluded custom permalinks and redirects?
Keep in mind that if you opt to exclude a specific type of content, the plugin will stop generating custom permalinks for new items of that type. However, the existing custom permalinks will stay in the database and they will not be deleted automatically. This is to guarantee that no data is lost without your consent when debugging the permalink system.
If you want to reduce the size of the custom permalinks array and remove the excluded items from the database, go to "Tools -> Permalink Duplicates" and click "Fix custom permalinks & redirects" button. As a result, the excluded post and term items will no longer be included in the custom permalinks array.
Exclude posts/pages/terms by ID
For situations when third-party plugins cause incompatibility issues you can configure Permalink Manager to ignore particular posts or terms. Specifically, you may prevent Permalink Manager from rewriting URLs for certain posts, pages, custom post types, categories, post tags, and custom taxonomies by using their numeric IDs.
Depending on the content item you want to exclude, you may do so using one of two fields:
- The first, "Exclude posts/pages by ID" is for defining IDs for posts, pages, and custom post types.
- The second option, "Exclude terms by ID" is intended exclusively for categories, post tags, and custom taxonomies.
Exclude drafts & pending posts
WordPress creates slugs, also known as permalinks or URL slugs, depending on the titles of posts or pages. However, WordPress does not automatically create the slug for draft posts, and there are solid reasons for this. When a post is in draft mode, it is still being edited and may be subject to changes such as title changes or category reassignment. These modifications may have an influence on the final format of the permalink.
To prevent mismatch between the URL and the actual content of the post, WordPress generates the slug only when the article is ready to be published. This guarantees that the right permalink is created at the time of publishing, reflecting the finished version of the post.
Permalink Manager, like the built-in permalink system, generates the custom permalink only when the post is published. You may, however, opt to enable custom permalink editing even for draft or pending posts through using the "Exclude drafts & pending posts" dropdown field:
Code snippets
In addition to the plugin's settings, you can also use a code snippet to exclude certain content items from Permalink Manager.
Exclude by ID
This can be useful in the event of a conflict with a third-party module or theme, as it allows to dynamically exclude IDs as needed.
/**
* Add a specific post, page, custom post type item to the exclusion list for Permalink Manager.
*
* @param array $ids An array of excluded post IDs.
* @return array The modified array of excluded post IDs.
*/
function pm_exclude_page( $ids ) {
	$exclude_ids = array( 2262, 3344, 5566 ); // Add the IDs you want to exclude
	if ( is_array( $ids ) ) {
		 $ids = array_merge( $ids, $exclude_ids );
	}
	 return $ids;
}
add_filter( 'permalink_manager_excluded_post_ids', 'pm_exclude_page' );
/**
* Add a specific category, tag, custom taxonomy term to the exclusion list for Permalink Manager.
*
*
* @param array $ids An array of excluded term IDs.
* @return array The modified array of excluded term IDs.
*/
function pm_exclude_term( $ids ) {
	$exclude_ids = array( 420, 789, 1234 ); // Add the IDs you want to exclude
	if ( is_array( $ids ) ) {
		 $ids = array_merge( $ids, $exclude_ids );
	}
	 return $ids;
}
add_filter( 'permalink_manager_excluded_term_ids', 'pm_exclude_term' );
Exclude by post date
To exclude posts or pages published before a specific date, use the following snippet. This can stop unwanted URL changes, which could harm SEO for content that is already indexed and linked.
/**
* Exclude post/pages published before December 1, 2024 from Permalink Manager
*
* @param bool $bool "True" if the post/page needs to be excluded
* @param WP_Post $post The post object.
* @return bool The modified bool.
*/
function pm_ignore_old_uris( $bool, $post ) {
	if ( ! empty( $post ) && strtotime( $post->post_date ) < strtotime( '2024-12-01' ) ) {
		return false;
	}
	return $bool;
}
add_filter( 'permalink_manager_allow_new_post_uri', 'pm_ignore_old_uris', 10, 2 );
add_filter( 'permalink_manager_allow_update_post_uri', 'pm_ignore_old_uris', 10, 2 );