add_term_relationship
Fires immediately before an object-term relationship is added.
Usage
add_action( 'add_term_relationship', 'wp_kama_add_term_relationship_action', 10, 3 ); /** * Function for `add_term_relationship` action-hook. * * @param int $object_id Object ID. * @param int $tt_id Term taxonomy ID. * @param string $taxonomy Taxonomy slug. * * @return void */ function wp_kama_add_term_relationship_action( $object_id, $tt_id, $taxonomy ){ // action... }
- $object_id(int)
- Object ID.
- $tt_id(int)
- Term taxonomy ID.
- $taxonomy(string)
- Taxonomy slug.
Changelog
Since 2.9.0 | Introduced. |
Since 4.7.0 | Added the $taxonomy parameter. |
Where the hook is called
wp-includes/taxonomy.php 2867
do_action( 'add_term_relationship', $object_id, $tt_id, $taxonomy );