From da77df683e2a7b6820f4bcd0fac8d5308c204924 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: https://develop.svn.wordpress.org/trunk@23552 602fd350-edb4-49c9-b593-d223f7449a82 --- 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;