Make WordPress Core

Ticket #4855: empty_post_redirect.diff

File empty_post_redirect.diff, 775 bytes (added by ryan, 19 years ago)
  • wp-admin/includes/post.php

     
    285285        // Create the post.
    286286        $post_ID = wp_insert_post( $_POST );
    287287
     288        if ( empty($post_ID) )
     289                return 0;
     290
    288291        add_meta( $post_ID );
    289292
    290293        // Reunite any orphaned attachments with their parent
  • wp-admin/post.php

     
    3838        if ( isset($_POST['save']) )
    3939                $location = "post.php?action=edit&post=$post_ID";
    4040
     41        if ( empty($post_ID) )
     42                $location = 'post-new.php';
     43
    4144        wp_redirect($location);
    4245        exit();
    4346        break;