Make WordPress Core

Ticket #46076: 46076.diff

File 46076.diff, 949 bytes (added by pento, 7 years ago)
  • src/wp-admin/includes/post.php

    diff --git a/src/index.php b/src/index.php
    old mode 100644
    new mode 100755
    diff --git a/src/wp-admin/includes/post.php b/src/wp-admin/includes/post.php
    index ef732407de..462fe36678 100644
    a b function edit_post( $post_data = null ) { 
    429429                }
    430430        }
    431431
     432        /*
     433         * If this post save is actually a meta box save triggered immediately after an autosave from the block editor,
     434         * we need to update the autosave date to after this save, so that it isn't auto-deleted as being outdated.
     435         */
     436        if ( isset( $_GET['meta-box-loader'] ) ) {
     437                $autosave = wp_get_post_autosave( $post_id, get_current_user_id() );
     438                if ( $autosave ) {
     439                        /*
     440                         * We need to wait for 1 second, to ensure the updated autosave will have a later
     441                         * post_modified_gmt than the post updated above.
     442                         */
     443                        sleep( 1 );
     444                        wp_update_post( $autosave );
     445                }
     446        }
     447
    432448        return $post_ID;
    433449}
    434450