Support

Account

Home Forums General Issues Programmatic duplication Reply To: Programmatic duplication

  • I’m a little confused about why the field key references the old post if you get all the meta from one post and add them to another.

    You should end up with something like.

    
    post_id       meta_key      meta_value
    {old_post}    field_name    value
    {old_post}    _field_name   field_1234567890123
    {new_post}    field_name    value
    {new_post}    _field_name   field_1234567890123
    

    The field keys should still be the same with a different post_id, unless you’re trying to also put the fields into a duplicated field group with different field keys.

    Either that or I’m completely lost about what you’re trying to accomplish. If you’re just trying to duplicate a post have you tried https://wordpress.org/plugins/duplicate-post/. It works well with ACF.