Don't create '0' categories. fixes #4413

git-svn-id: https://develop.svn.wordpress.org/trunk@5739 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2007-06-20 22:06:29 +00:00
parent d907ae8841
commit fdb786ba7f
2 changed files with 7 additions and 0 deletions

View File

@@ -796,6 +796,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
// If $post_categories isn't already an array, make it one:
if (!is_array($post_categories) || 0 == count($post_categories) || empty($post_categories))
$post_categories = array(get_option('default_category'));
else if ( 1 == count($post_categories) && '' == $post_categories[0] )
return true;
$post_categories = array_map('intval', $post_categories);
$post_categories = array_unique($post_categories);