wp_add_object_terms()WP 3.6.0

Adds term(s) associated with a given object.

Хуков нет.

Возвращает

Массив|WP_Error. Term taxonomy IDs of the affected terms.

Использование

wp_add_object_terms( $object_id, $terms, $taxonomy );
$object_id(int) (обязательный)
The ID of the object to which the terms will be added.
$terms(строка|int|массив) (обязательный)
The slug(s) or ID(s) of the term(s) to add.
$taxonomy(массив|строка) (обязательный)
Taxonomy name.

Список изменений

С версии 3.6.0 Введена.

Код wp_add_object_terms() WP 6.5.2

function wp_add_object_terms( $object_id, $terms, $taxonomy ) {
	return wp_set_object_terms( $object_id, $terms, $taxonomy, true );
}