Make WordPress Core


Ignore:
Timestamp:
02/22/2010 05:19:54 PM (15 years ago)
Author:
ryan
Message:

Don't require a default category for attachment types other than 'post'. Props jfarthing84. see #9674

File:
1 edited

Legend:

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

    r13289 r13291  
    31343134    extract($object, EXTR_SKIP);
    31353135
    3136     // Make sure we set a valid category
    3137     if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category)) {
    3138         $post_category = array(get_option('default_category'));
    3139     }
    3140 
    31413136    if ( empty($post_author) )
    31423137        $post_author = $user_ID;
     
    31443139    $post_type = 'attachment';
    31453140    $post_status = 'inherit';
     3141   
     3142    // Make sure we set a valid category.
     3143    if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
     3144        // 'post' requires at least one category.
     3145        if ( 'post' == $post_type )
     3146            $post_category = array( get_option('default_category') );
     3147        else
     3148            $post_category = array();
     3149    }   
    31463150
    31473151    // Are we updating or creating?
Note: See TracChangeset for help on using the changeset viewer.