WordPress.org

Make WordPress Core

Ticket #23691: post.php.patch

File post.php.patch, 785 bytes (added by utkarshd_42, 5 years ago)

wp-includes/post.php

  • post.php

     
    27262726 */
    27272727function wp_insert_post( $postarr, $wp_error = false ) {
    27282728        global $wpdb;
    2729 
     2729        //The my_check_object finds out the largest ID for a post which also is the most recent one
     2730        $my_check_object= $wpdb->get_var("SELECT * FROM $wpdb->posts ORDER BY ID DESC",0,0);
    27302731        $user_id = get_current_user_id();
    27312732
    27322733        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_id,
     
    27472748        // Are we updating or creating?
    27482749        $post_ID = 0;
    27492750        $update = false;
    2750         if ( ! empty( $ID ) ) {
     2751        if ( ! empty( $ID ) && $my_check_object<=$ID) {
    27512752                $update = true;
    27522753
    27532754                // Get the post ID and GUID