1. Home
  2. Docs
  3. Features
  4. How to prevent the post slugs from being added to the default URIs?

How to prevent the post slugs from being added to the default URIs?

By default, Permalink Manager automatically appends the post/term slugs to the end of predefined custom permalink.

If you would like to disable this feature, please go to Permastructure section and click on “Show additional settings” for each post type & taxonomy that should be affected.

After the extra container is displayed, please select “Do not automatically append the slug” & save the settings.

Alternative method (prior to 2.2.3) version:

It is also possible to stop the post slugs from being added to the default URI programmatically. To do so, please use one of the following snippets:

You can either limit the snippet to selected post types (eg. products and pages):

function pm_donot_append_slug($bool, $post_type) {
	return (in_array($post_type, array('product', 'page'))) ? true : $bool;
}
add_filter('permalink_manager_do_not_append_slug', 'pm_donot_append_slug', 9, 2);

… or do not append the slug to any post type default permalinks at all:

add_filter('permalink_manager_do_not_append_slug', '__return_true', 9, 2);
Was this article helpful to you? Yes No