added_term_relationship
Action HookDescription
Fires immediately after an object-term relationship is added.Hook Information
File Location |
wp-includes/taxonomy.php
View on GitHub
|
Hook Type | Action |
Line Number | 2899 |
Hook Parameters
Type | Name | Description |
---|---|---|
int
|
$object_id
|
Object ID. |
int
|
$tt_id
|
Term taxonomy ID. |
string
|
$taxonomy
|
Taxonomy slug. |
Usage Examples
Basic Usage
<?php
// Hook into added_term_relationship
add_action('added_term_relationship', 'my_custom_function', 10, 3);
function my_custom_function($object_id, $tt_id, $taxonomy) {
// Your custom code here
}
Source Code Context
wp-includes/taxonomy.php:2899
- How this hook is used in WordPress core
<?php
2894 *
2895 * @param int $object_id Object ID.
2896 * @param int $tt_id Term taxonomy ID.
2897 * @param string $taxonomy Taxonomy slug.
2898 */
2899 do_action( 'added_term_relationship', $object_id, $tt_id, $taxonomy );
2900
2901 $new_tt_ids[] = $tt_id;
2902 }
2903
2904 if ( $new_tt_ids ) {
PHP Documentation
<?php
/**
* 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 string $taxonomy Taxonomy slug.
*/
Quick Info
- Hook Type: Action
- Parameters: 3
- File: wp-includes/taxonomy.php
Related Hooks
Related hooks will be displayed here in future updates.