Creates a duplicate of the post object passed as the first parameter, according to the current settings except for status: the original status is copied by default unless a new status is explicitly specified.


<?php $new_post_id = duplicate_post_create_duplicate( $post, $status, $parent_id ); ?>


  • $post
    • (int|WP_Post|null) post object to be cloned.
  • $status
    • (string) (optional) new status to set for the copy
      • Default: empty string
  • $parent_id
    • (integer) (optional) ID of the post to set as parent for the copy
      • Default: empty string

Return values

  • (int|WP_Error) The post ID on success. The value 0 or WP_Error on failure.