WordPress.org

Make WordPress Core

Ticket #18800: 18800v2.diff

File 18800v2.diff, 796 bytes (added by MattyRob, 3 years ago)
  • wp-admin/post-new.php

     
    3636wp_enqueue_script('autosave'); 
    3737 
    3838// Show post form. 
    39 $post = get_default_post_to_edit( $post_type, true ); 
     39$posts = get_posts(array('numberposts' => 1, 'post_status' => 'auto-draft')); 
     40$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post[0]->ID ); 
     41$attachments = get_posts($args); 
     42if ( empty($posts) && empty($attachments) && $post[0] != $user_ID ) { 
     43        $post = get_default_post_to_edit( $post_type, true ); 
     44} else { 
     45        $post = $posts[0]; 
     46} 
    4047$post_ID = $post->ID; 
    4148include('edit-form-advanced.php'); 
    4249include('./admin-footer.php');