mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
use reset vs offset 0, props scribu, see #13246
git-svn-id: http://svn.automattic.com/wordpress/trunk@14447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b28c363d78
commit
1beb7406da
@ -2567,12 +2567,12 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
$post_ID = (int) $post_ID;
|
||||
$post_type = get_post_type( $post_ID );
|
||||
// If $post_categories isn't already an array, make it one:
|
||||
if ( !is_array($post_categories) || 0 == count($post_categories) || empty($post_categories) ) {
|
||||
if ( !is_array($post_categories) || empty($post_categories) ) {
|
||||
if ( 'post' == $post_type )
|
||||
$post_categories = array( get_option('default_category') );
|
||||
else
|
||||
$post_categories = array();
|
||||
} else if ( 1 == count($post_categories) && '' == $post_categories[0] ) {
|
||||
} else if ( 1 == count($post_categories) && '' == reset($post_categories) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user