WordPress.org

Forums

wp_insert_post() doesnt create revision (2 posts)

  1. essha
    Member
    Posted 1 year ago #

    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?

  2. Rajan V
    Member
    Posted 1 year ago #

    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 ); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.