WordPress.org

Ready to get started?Download WordPress

Forums

wp_insert_post() doesnt create revision (2 posts)

  1. essha
    Member
    Posted 3 months 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 3 months 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 ); ?>

Reply

You must log in to post.

About this Topic

Tags

No tags yet.