wp_add_object_terms

The timeline below displays how wordpress function wp_add_object_terms has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Adds term(s) associated with a given object.
 *
 * @since 3.6.0
 *
 * @param int              $object_id The ID of the object to which the terms will be added.
 * @param string|int|array $terms     The slug(s) or ID(s) of the term(s) to add.
 * @param array|string     $taxonomy  Taxonomy name.
 * @return array|WP_Error Term taxonomy IDs of the affected terms.
 */
function wp_add_object_terms($object_id, $terms, $taxonomy)
{
    return wp_set_object_terms($object_id, $terms, $taxonomy, true);
}

WordPress Version: 4.8

/**
 * Add term(s) associated with a given object.
 *
 * @since 3.6.0
 *
 * @param int              $object_id The ID of the object to which the terms will be added.
 * @param string|int|array $terms     The slug(s) or ID(s) of the term(s) to add.
 * @param array|string     $taxonomy  Taxonomy name.
 * @return array|WP_Error Term taxonomy IDs of the affected terms.
 */
function wp_add_object_terms($object_id, $terms, $taxonomy)
{
    return wp_set_object_terms($object_id, $terms, $taxonomy, true);
}

WordPress Version: 4.5

/**
 * Add term(s) associated with a given object.
 *
 * @since 3.6.0
 *
 * @param int              $object_id The ID of the object to which the terms will be added.
 * @param array|int|string $terms     The slug(s) or ID(s) of the term(s) to add.
 * @param array|string     $taxonomy  Taxonomy name.
 * @return array|WP_Error Term taxonomy IDs of the affected terms.
 */
function wp_add_object_terms($object_id, $terms, $taxonomy)
{
    return wp_set_object_terms($object_id, $terms, $taxonomy, true);
}

WordPress Version: 4.3

/**
 * Add term(s) associated with a given object.
 *
 * @since 3.6.0
 *
 * @param int              $object_id The ID of the object to which the terms will be added.
 * @param array|int|string $terms     The slug(s) or ID(s) of the term(s) to add.
 * @param array|string     $taxonomy  Taxonomy name.
 * @return array|WP_Error Affected Term IDs
 */
function wp_add_object_terms($object_id, $terms, $taxonomy)
{
    return wp_set_object_terms($object_id, $terms, $taxonomy, true);
}

WordPress Version: 4.1

/**
 * Add term(s) associated with a given object.
 *
 * @since 3.6.0
 *
 * @param int $object_id The ID of the object to which the terms will be added.
 * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to add.
 * @param array|string $taxonomy Taxonomy name.
 * @return array|WP_Error Affected Term IDs
 */
function wp_add_object_terms($object_id, $terms, $taxonomy)
{
    return wp_set_object_terms($object_id, $terms, $taxonomy, true);
}

WordPress Version: 3.9

/**
 * Add term(s) associated with a given object.
 *
 * @since 3.6.0
 * @uses wp_set_object_terms()
 *
 * @param int $object_id The ID of the object to which the terms will be added.
 * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to add.
 * @param array|string $taxonomy Taxonomy name.
 * @return array|WP_Error Affected Term IDs
 */
function wp_add_object_terms($object_id, $terms, $taxonomy)
{
    return wp_set_object_terms($object_id, $terms, $taxonomy, true);
}

WordPress Version: 3.7

/**
 * Add term(s) associated with a given object.
 *
 * @package WordPress
 * @subpackage Taxonomy
 * @since 3.6
 * @uses wp_set_object_terms()
 *
 * @param int $object_id The ID of the object to which the terms will be added.
 * @param array|int|string $terms The slug(s) or ID(s) of the term(s) to add.
 * @param array|string $taxonomy Taxonomy name.
 * @return array|WP_Error Affected Term IDs
 */
function wp_add_object_terms($object_id, $terms, $taxonomy)
{
    return wp_set_object_terms($object_id, $terms, $taxonomy, true);
}