WordPress.org

Support

Support » How-To and Troubleshooting » wp_insert_post() doesnt create revision

wp_insert_post() doesnt create revision

  • Creating a new post via backend inserts additional a revision at table wp_posts with same date.
    But creating via wp_insert_post() does not.

    What is the correct way to add a post programmatically?

Viewing 1 replies (of 1 total)
  • Rajan V
    Member

    @rajanit2000

    Hi essha.,

    wp_insert_post() does not create any revision because its new post it does not need to create revision. Revision means backup of existing one.

    You can use <?php wp_update_post( $post ); ?>

Viewing 1 replies (of 1 total)
  • The topic ‘wp_insert_post() doesnt create revision’ is closed to new replies.