WordPress.org

Make WordPress Core

Ticket #12859: preview-blank.diff

File preview-blank.diff, 1.2 KB (added by duck_, 4 years ago)
  • wp-admin/includes/post.php

     
    12841284 */ 
    12851285function post_preview() { 
    12861286 
    1287         $post_ID = (int) $_POST['post_ID']; 
    1288         if ( $post_ID < 1 ) 
     1287        if ( isset( $_POST['auto_draft'] ) && '1' == $_POST['auto_draft'] ) 
    12891288                wp_die( __('Preview not available. Please save as a draft first.') ); 
    12901289 
    12911290        if ( isset($_POST['catslist']) ) 
     
    12971296        if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) ) 
    12981297                unset($_POST['post_category']); 
    12991298 
     1299        $post_ID = (int) $_POST['post_ID'];      
    13001300        $_POST['ID'] = $post_ID; 
    13011301        $post = get_post($post_ID); 
    13021302 
  • wp-includes/js/autosave.dev.js

     
    144144 
    145145function autosave_update_post_ID( postID ) { 
    146146        if ( !isNaN(postID) && postID > 0 ) { 
    147                 if ( postID == parseInt(jQuery('#post_ID').val(), 10) ) { return; } // no need to do this more than once 
    148147                notSaved = false; 
    149148                autosave_enable_buttons(); 
    150149                jQuery('#delete-action a.submitdelete').fadeIn();