From 73feece365b26dd92c6db4ecea508ffd6cb14e51 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 11 Apr 2007 18:04:49 +0000 Subject: [PATCH] Allow passing an empty tag set to wp_set_post_tags() so all tags can be removed from a post. see #3723 git-svn-id: https://develop.svn.wordpress.org/trunk@5243 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 6ec14aaaec..7b84716e96 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -799,7 +799,9 @@ function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { // prevent warnings for unintialized variables $tag_ids = array(); - + + if ( empty($tags) ) + $tags = array(); $tags = (is_array($tags)) ? $tags : explode( ',', $tags ); foreach ( $tags as $tag ) { @@ -810,8 +812,8 @@ function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { $tag_id = wp_create_tag( $tag ); $tag_ids[] = $tag_id; } - - if ( empty($tag_ids) ) + + if ( empty($tag_ids) && ( !empty($tags) || $append ) ) return false; $tag_ids = array_unique( $tag_ids );