Support » Plugin: Permalink Manager Lite » Auto permalink guess issue with “Duplicate this” plugin

  • Resolved morespinach


    Hello. We use Permalink Manager Lite along with a helpful Duplicate This plugin that allows us to create complex records more quickly (many custom fields, which come pre-populated so with some quick edits the whole post is quickly ready).

    The challenge is that the way Permalink Manager Lite is guessing the unique URL for the just-created duplicate post (not yet saved, just created) is weird. It’s adding random digits to the URL.

    For example if this is the permalink of the original custom post:


    After duplicating, it’s guessing it to:


    Where are all those 2s and 3s coming from? How can we fix it to be just a -2 or something simple?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Maciej Bis


    Hi again @morespinach,

    when you duplicate the post, WordPress adds the numeric index to the end of native slug to make the post slug unique.

    If you duplicate, the post that were duplicated before, the numeric index will be preserved.

    Orignal post:

    First duplicate:

    Second duplicate (duplicate of first duplicate):

    and so on.

    I would recommend to manually adjust the custom permalink to make it unique. If you would like to strip the duplicated indexes, you can use this code snippet:

    function pm_filter_default_post_uris($default_uri, $native_slug, $post, $slug, $native_uri) {
    	return preg_replace('/([\d-]+)$/', '-2', $default_uri);
    add_filter('permalink_manager_filter_default_post_uri', 'pm_filter_default_post_uris', 999, 5);

    Best regards,

    • This reply was modified 5 months ago by Maciej Bis.


    Thank you. Let me try this. The issue is that the third time the second duplicate is saved, the URL is not


    Instead, it is something much longer:


    Something like that. Anyway, let me try your code. Thanks!



    This “works” I think, but now the ‘native slug’ is coming up empty.

    The default permalink is the same as the original. So I change it manually to add a “2” or something. But the native slug is totally empty even when I save this new permalink.

    Is this an issue? What should I do to fix that

    Plugin Author Maciej Bis


    The native slug is empty, if the duplicated post status is set to “draft”. The slug is generated only after the post is published unless you change/adjust it manually. It should work exactly the same way even if my plugin is not active.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.