WordPress.org

Make WordPress Core

Ticket #13904: allow-new-post-objects.13904.diff

File allow-new-post-objects.13904.diff, 980 bytes (added by filosofo, 8 years ago)
  • wp-includes/post.php

     
    20772077
    20782078        $post = get_post($postid, $mode);
    20792079
     2080        if (
     2081                ( OBJECT == $mode && empty( $post->ID ) ) ||
     2082                ( OBJECT != $mode && empty( $post['ID'] ) )
     2083        )
     2084                return ( OBJECT == $mode ? null : array() );
     2085
    20802086        // Set categories and tags
    20812087        if ( $mode == OBJECT ) {
    20822088                $post->post_category = array();
     
    24182424                $post_cats = $post['post_category'];
    24192425
    24202426        // Drafts shouldn't be assigned a date unless explicitly done so by the user
    2421         if ( in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
     2427        if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
    24222428                         ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
    24232429                $clear_date = true;
    24242430        else