Support » Plugin: 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:
    https://domain.com/doc/?edit=9066

    Can this be achieved?

    Thanks
    Aldo

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

    (@lopo)

    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.

    Aldo

    (@ab_lu)

    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.

    Thanks
    Aldo

    @lopo
    Would appreciate any feedback or help.
    Thanks.

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