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:
parent
e3148fb526
commit
e58f456cb1
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue