HTTP/2 301
server: nginx
date: Mon, 29 Dec 2025 12:40:45 GMT
content-type: text/html; charset=UTF-8
location: https://developer.wordpress.org/reference/functions/wp_add_object_terms/
x-content-type-options: nosniff
content-language: en
x-ua-compatible: IE=Edge
vary: Accept-Encoding, Cookie
expires: Thu, 01 Jan 1970 00:00:00 GMT
cache-control: no-cache, no-store, max-age=0, must-revalidate
pragma: no-cache
alt-svc: h3=":443"; ma=86400
strict-transport-security: max-age=31536000
HTTP/2 200
server: nginx
date: Mon, 29 Dec 2025 12:40:47 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-olaf: ⛄
vary: accept, content-type
link:
; rel="https://api.w.org/"
link:
; rel="alternate"; title="JSON"; type="application/json"
link: ; rel=shortlink
x-frame-options: SAMEORIGIN
content-encoding: gzip
alt-svc: h3=":443"; ma=86400
x-nc: MISS ord 2
wp_add_object_terms() – Function | Developer.WordPress.org
wp_add_object_terms( int $object_id, string|int|array $terms, array|string $taxonomy ): array|WP_Error
Adds term(s) associated with a given object.
$object_idintrequiredThe ID of the object to which the terms will be added.
$termsstring|int|arrayrequiredThe slug(s) or ID(s) of the term(s) to add.
$taxonomyarray|stringrequiredTaxonomy name.
array|WP_Error Term taxonomy IDs of the affected terms.
| Version | Description |
|---|
| 3.6.0 | Introduced. |
Set categories for an attachment