From e58f456cb1e1de2242a74e483cd21ac386375d53 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 1 Mar 2013 16:22:07 +0000 Subject: [PATCH] Make wp_remove_object_terms() return false if nothing has been deleted. props kovshenin. fixes #15475. git-svn-id: http://core.svn.wordpress.org/trunk@23552 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/taxonomy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php index d9a9845cbe..063887cbc9 100644 --- a/wp-includes/taxonomy.php +++ b/wp-includes/taxonomy.php @@ -2312,11 +2312,11 @@ function wp_remove_object_terms( $object_id, $terms, $taxonomy ) { if ( $tt_ids ) { $in_tt_ids = "'" . implode( "', '", $tt_ids ) . "'"; do_action( 'delete_term_relationships', $object_id, $tt_ids ); - $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) ); + $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) ); do_action( 'deleted_term_relationships', $object_id, $tt_ids ); wp_update_term_count( $tt_ids, $taxonomy ); - return true; + return (bool) $deleted; } return false;