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
This commit is contained in:
Sergey Biryukov 2013-03-01 16:22:07 +00:00
parent e3148fb526
commit e58f456cb1
1 changed files with 2 additions and 2 deletions

View File

@ -2312,11 +2312,11 @@ function wp_remove_object_terms( $object_id, $terms, $taxonomy ) {
if ( $tt_ids ) { if ( $tt_ids ) {
$in_tt_ids = "'" . implode( "', '", $tt_ids ) . "'"; $in_tt_ids = "'" . implode( "', '", $tt_ids ) . "'";
do_action( 'delete_term_relationships', $object_id, $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 ); do_action( 'deleted_term_relationships', $object_id, $tt_ids );
wp_update_term_count( $tt_ids, $taxonomy ); wp_update_term_count( $tt_ids, $taxonomy );
return true; return (bool) $deleted;
} }
return false; return false;