Title: set_object_terms
Published: April 25, 2014
Last modified: August 20, 2026

---

# do_action( ‘set_object_terms’, int $object_id, array $terms, array $tt_ids, string $taxonomy, bool $append, array $old_tt_ids )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/set_object_terms/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/set_object_terms/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/set_object_terms/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/set_object_terms/?output_format=md#changelog)

Fires after an object’s terms have been set.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/set_object_terms/?output_format=md#parameters)󠁿

 `$object_id`int

Object ID.

`$terms`array

An array of object term IDs or slugs.

`$tt_ids`array

An array of term taxonomy IDs.

`$taxonomy`string

Taxonomy slug.

`$append`bool

Whether to append new terms to the old terms.

`$old_tt_ids`array

Old array of term taxonomy IDs.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/set_object_terms/?output_format=md#source)󠁿

    ```php
    do_action( 'set_object_terms', $object_id, $terms, $tt_ids, $taxonomy, $append, $old_tt_ids );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/taxonomy.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-includes/taxonomy.php#L3007)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-includes/taxonomy.php#L3007-L3007)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/set_object_terms/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_set_object_terms()](https://developer.wordpress.org/reference/functions/wp_set_object_terms/)`wp-includes/taxonomy.php` |

Creates term and taxonomy relationships.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/set_object_terms/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fset_object_terms%2F)
before being able to contribute a note or feedback.