• Resolved needatechy

    (@needatechy)


    Hi

    I can successfully in PHP duplicate a page using the function calls for the Yoast Duplicate Page Plugin, however I want to be able to give the target page a definitive name, so rather than ‘a’ to ‘copy of a’, I would like to do ‘a’ to ‘b’, is this possible?

    Mike

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi,

    We would like some more information.

    1. Are you using 3.2.6 of Duplicate Post?

    2. If you go to Settings-Duplicate Post do the title prefix and suffix fields show blank? If not, please remove what is shown and see if the issue resolves.

    Thread Starter needatechy

    (@needatechy)

    Hi Pcosta88

    Thanks for the response.
    I am using 3.26 and I am aware of the prefix and suffix option, but this does not help I want to be able to duplicate to a completely different title,
    i.e. not A to Copy of A but A to B

    I Hope this makes sense.

    Mike

    Plugin Support Michael Tiña

    (@mikes41720)

    Hi,

    You might want to check out our available filters, actions, functions, and template tags for the Yoast Duplicate Post plugin and see if you can use one of the available filters to change the title when duplicating a post or page — https://developer.yoast.com/duplicate-post/overview/

    Thread Starter needatechy

    (@needatechy)

    Hi Michael,

    I was just looking at filters, do they actually change the database details or just the display?

    Regards
    Mike

    Plugin Author Enrico Battocchi

    (@lopo)

    Hi @needatechy,
    the filters by their own don’t change anything in the database. Two of them are realted with the displaying of the links, and two others are used to change the meta fields that are copied so they probably aren’t what you need.

    For your purpose of storing a different title for the copy you might use the action hook dp_duplicate_post (if you are dealing with a hierarchical post type, it’s dp_duplicate_page)
    In the callback function you can get the copy object by its ID, then change the title and store it again with wp_update_post().

    Let us know if this is helpful for your needs!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Renaming the copied page’ is closed to new replies.