Support » Plugin: Yoast Duplicate Post » Custom Redirect after duplicate_post_clone_post_link

  • Hello

    We are looking for a way to redirect the user to a specific page after he clicked on the link generated by duplicate_post_clone_post_link().

    Ideally grabbing the ID of the newly generated post like:

    Can this be achieved?


Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Enrico Battocchi


    Hi @ab_lu,
    there is a filter called duplicate_post_get_clone_post_link which is applied to the URL which goes in the “Clone” or “New Draft” link. You can find it in the file duplicate-post-common.php, in the final return statement of the duplicate_post_get_clone_post_link function.

    Let me know if this helps!

    I am trying to add the exact same functionality that @ab_lu described above. I looked at the return statement that @lopo referenced in the duplicate-post-common.php with the duplicate_post_get_clone_post_link filter, but I’m not sure how to proceed.

    I was wondering if either of you could provide an snippet or pseudo-code of what I should add to my custom theme’s functions.php file in order to achieve this?

    I’m not very familiar with hooking into filters in WordPress, so any guidance with a little more detail on how to do this, or an example would be much appreciated.

    Thank you.



    Hi @lopo

    Thanks for the feedback.

    But I’m at the same point as @cnvrsepnk.
    Can’t get it to work.

    We use in the frontend
    <?php duplicate_post_clone_post_link( ); ?>

    Then we get the link “Copy to a new draft”.
    What we try is to set it so, that after the copy has been created, it should be published and the user redirected to the page he has clicked the copy link.

    Would be great, if you could point us to the right direction.


    Would appreciate any feedback or help.

    @lopo Could you point us to the right direction please?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Redirect after duplicate_post_clone_post_link’ is closed to new replies.