Ticket #13531: 13531.diff
| File 13531.diff, 1.5 KB (added by , 16 years ago) |
|---|
-
wp-includes/post.php
2174 2174 if ( empty($post_type) ) 2175 2175 $post_type = 'post'; 2176 2176 2177 if ( empty($post_status) ) 2178 $post_status = 'draft'; 2179 2177 2180 if ( !empty($post_category) ) 2178 2181 $post_category = array_filter($post_category); // Filter out empty terms 2179 2182 2180 2183 // Make sure we set a valid category. 2181 2184 if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) { 2182 2185 // 'post' requires at least one category. 2183 if ( 'post' == $post_type )2186 if ( 'post' == $post_type && 'auto-draft' != $post_status ) 2184 2187 $post_category = array( get_option('default_category') ); 2185 2188 else 2186 2189 $post_category = array(); … … 2189 2192 if ( empty($post_author) ) 2190 2193 $post_author = $user_ID; 2191 2194 2192 if ( empty($post_status) )2193 $post_status = 'draft';2194 2195 2195 $post_ID = 0; 2196 2196 2197 2197 // Get the post ID and GUID … … 2660 2660 function wp_set_post_categories($post_ID = 0, $post_categories = array()) { 2661 2661 $post_ID = (int) $post_ID; 2662 2662 $post_type = get_post_type( $post_ID ); 2663 $post_status = get_post_status( $post_ID ); 2663 2664 // If $post_categories isn't already an array, make it one: 2664 2665 if ( !is_array($post_categories) || empty($post_categories) ) { 2665 if ( 'post' == $post_type )2666 if ( 'post' == $post_type && 'auto-draft' != $post_status ) 2666 2667 $post_categories = array( get_option('default_category') ); 2667 2668 else 2668 2669 $post_categories = array();
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)