Make WordPress Core

Changeset 14883


Ignore:
Timestamp:
05/25/2010 02:43:39 PM (15 years ago)
Author:
ryan
Message:

Don't set default category when saving an auto-draft. fixes #13531

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r14857 r14883  
    21752175        $post_type = 'post';
    21762176
     2177    if ( empty($post_status) )
     2178        $post_status = 'draft';
     2179
    21772180    if ( !empty($post_category) )
    21782181        $post_category = array_filter($post_category); // Filter out empty terms
     
    21812184    if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
    21822185        // 'post' requires at least one category.
    2183         if ( 'post' == $post_type )
     2186        if ( 'post' == $post_type && 'auto-draft' != $post_status )
    21842187            $post_category = array( get_option('default_category') );
    21852188        else
     
    21892192    if ( empty($post_author) )
    21902193        $post_author = $user_ID;
    2191 
    2192     if ( empty($post_status) )
    2193         $post_status = 'draft';
    21942194
    21952195    $post_ID = 0;
     
    26612661    $post_ID = (int) $post_ID;
    26622662    $post_type = get_post_type( $post_ID );
     2663    $post_status = get_post_status( $post_ID );
    26632664    // If $post_categories isn't already an array, make it one:
    26642665    if ( !is_array($post_categories) || empty($post_categories) ) {
    2665         if ( 'post' == $post_type )
     2666        if ( 'post' == $post_type && 'auto-draft' != $post_status )
    26662667            $post_categories = array( get_option('default_category') );
    26672668        else
Note: See TracChangeset for help on using the changeset viewer.