Ticket #13246: 14438.diff
| File 14438.diff, 1.3 KB (added by scribu, 3 years ago) |
|---|
-
wp-includes/post.php
2084 2089 if ( empty($post_type) ) 2085 2090 $post_type = 'post'; 2086 2091 2087 if ( !empty($post_category) )2088 $post_category = array_filter($post_category); // Filter out empty terms2089 2090 // Make sure we set a valid category.2091 if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) {2092 // 'post' requires at least one category.2093 if ( 'post' == $post_type )2094 $post_category = array( get_option('default_category') );2095 else2096 $post_category = array();2097 }2098 2099 2092 if ( empty($post_author) ) 2100 2093 $post_author = $user_ID; 2101 2094 … … 2566 2559 $post_ID = (int) $post_ID; 2567 2560 $post_type = get_post_type( $post_ID ); 2568 2561 // If $post_categories isn't already an array, make it one: 2569 if ( !is_array($post_categories) || 0 == count($post_categories) ||empty($post_categories) ) {2562 if ( !is_array($post_categories) || empty($post_categories) ) { 2570 2563 if ( 'post' == $post_type ) 2571 2564 $post_categories = array( get_option('default_category') ); 2572 2565 else 2573 2566 $post_categories = array(); 2574 } else if ( 1 == count($post_categories) && '' == $post_categories[0]) {2567 } else if ( 1 == count($post_categories) && '' == reset($post_categories) ) { 2575 2568 return true; 2576 2569 } 2577 2570
