Action hook 'set_object_terms'

in WP Core File wp-includes/taxonomy.php at line 2966

View Source

set_object_terms

Action Hook
Description
Fires after an object's terms have been set.

Hook Information

File Location wp-includes/taxonomy.php View on GitHub
Hook Type Action
Line Number 2966

Hook Parameters

Type Name Description
int $object_id Object ID.
array $terms An array of object term IDs or slugs.
array $tt_ids An array of term taxonomy IDs.
string $taxonomy Taxonomy slug.
bool $append Whether to append new terms to the old terms.
array $old_tt_ids Old array of term taxonomy IDs.

Usage Examples

Basic Usage
<?php
// Hook into set_object_terms
add_action('set_object_terms', 'my_custom_function', 10, 6);

function my_custom_function($object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids) {
    // Your custom code here
}

Source Code Context

wp-includes/taxonomy.php:2966 - How this hook is used in WordPress core
<?php
2961  	 * @param array  $tt_ids     An array of term taxonomy IDs.
2962  	 * @param string $taxonomy   Taxonomy slug.
2963  	 * @param bool   $append     Whether to append new terms to the old terms.
2964  	 * @param array  $old_tt_ids Old array of term taxonomy IDs.
2965  	 */
2966  	do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids );
2967  
2968  	return $tt_ids;
2969  }
2970  
2971  /**

PHP Documentation

<?php
/**
	 * Fires after an object's terms have been set.
	 *
	 * @since 2.8.0
	 *
	 * @param int    $object_id  Object ID.
	 * @param array  $terms      An array of object term IDs or slugs.
	 * @param array  $tt_ids     An array of term taxonomy IDs.
	 * @param string $taxonomy   Taxonomy slug.
	 * @param bool   $append     Whether to append new terms to the old terms.
	 * @param array  $old_tt_ids Old array of term taxonomy IDs.
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 6
  • File: wp-includes/taxonomy.php
Related Hooks

Related hooks will be displayed here in future updates.