From acd49dc883401d6a291ccaae7d92987347e19f4b Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Sun, 18 Sep 2016 18:52:56 +0000 Subject: [PATCH] Pass taxonomy name to actions in term-relationship CRUD functions. Props Takahashi_Fumiki. Fixes #38006. git-svn-id: https://develop.svn.wordpress.org/trunk@38621 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/taxonomy.php | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php index a80809345b..80e1f84e06 100644 --- a/src/wp-includes/taxonomy.php +++ b/src/wp-includes/taxonomy.php @@ -2526,22 +2526,26 @@ function wp_set_object_terms( $object_id, $terms, $taxonomy, $append = false ) { * Fires immediately before an object-term relationship is added. * * @since 2.9.0 + * @since 4.7.0 Added the `$taxonomy` parameter. * - * @param int $object_id Object ID. - * @param int $tt_id Term taxonomy ID. + * @param int $object_id Object ID. + * @param int $tt_id Term taxonomy ID. + * @param string $taxonomy Taxonomy slug. */ - do_action( 'add_term_relationship', $object_id, $tt_id ); + do_action( 'add_term_relationship', $object_id, $tt_id, $taxonomy ); $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $tt_id ) ); /** * Fires immediately after an object-term relationship is added. * * @since 2.9.0 + * @since 4.7.0 Added the `$taxonomy` parameter. * - * @param int $object_id Object ID. - * @param int $tt_id Term taxonomy ID. + * @param int $object_id Object ID. + * @param int $tt_id Term taxonomy ID. + * @param string $taxonomy Taxonomy slug. */ - do_action( 'added_term_relationship', $object_id, $tt_id ); + do_action( 'added_term_relationship', $object_id, $tt_id, $taxonomy ); $new_tt_ids[] = $tt_id; } @@ -2661,11 +2665,13 @@ function wp_remove_object_terms( $object_id, $terms, $taxonomy ) { * Fires immediately before an object-term relationship is deleted. * * @since 2.9.0 + * @since 4.7.0 Added the `$taxonomy` parameter. * * @param int $object_id Object ID. * @param array $tt_ids An array of term taxonomy IDs. + * @param string $taxonomy Taxonomy slug. */ - do_action( 'delete_term_relationships', $object_id, $tt_ids ); + do_action( 'delete_term_relationships', $object_id, $tt_ids, $taxonomy ); $deleted = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id ) ); wp_cache_delete( $object_id, $taxonomy . '_relationships' ); @@ -2674,11 +2680,13 @@ function wp_remove_object_terms( $object_id, $terms, $taxonomy ) { * Fires immediately after an object-term relationship is deleted. * * @since 2.9.0 + * @since 4.7.0 Added the `$taxonomy` parameter. * - * @param int $object_id Object ID. - * @param array $tt_ids An array of term taxonomy IDs. + * @param int $object_id Object ID. + * @param array $tt_ids An array of term taxonomy IDs. + * @param string $taxonomy Taxonomy slug. */ - do_action( 'deleted_term_relationships', $object_id, $tt_ids ); + do_action( 'deleted_term_relationships', $object_id, $tt_ids, $taxonomy ); wp_update_term_count( $tt_ids, $taxonomy );