is_object_in_term

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

WordPress Version: 6.1

/**
 * Determines if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int                       $object_id ID of the object (post ID, link ID, ...).
 * @param string                    $taxonomy  Single taxonomy name.
 * @param int|string|int[]|string[] $terms     Optional. Term ID, name, slug, or array of such
 *                                             to check against. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    $object_id = (int) $object_id;
    if (!$object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID.'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy, array('update_term_meta_cache' => false));
        if (is_wp_error($object_terms)) {
            return $object_terms;
        }
        wp_cache_set($object_id, wp_list_pluck($object_terms, 'term_id'), "{$taxonomy}_relationships");
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    $ints = array_filter($terms, 'is_int');
    if ($ints) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints, true)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs, true)) {
                return true;
            }
            if (in_array($object_term->slug, $strs, true)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 5.7

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int                       $object_id ID of the object (post ID, link ID, ...).
 * @param string                    $taxonomy  Single taxonomy name.
 * @param int|string|int[]|string[] $terms     Optional. Term ID, name, slug, or array of such
 *                                             to check against. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    $object_id = (int) $object_id;
    if (!$object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID.'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy, array('update_term_meta_cache' => false));
        if (is_wp_error($object_terms)) {
            return $object_terms;
        }
        wp_cache_set($object_id, wp_list_pluck($object_terms, 'term_id'), "{$taxonomy}_relationships");
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    $ints = array_filter($terms, 'is_int');
    if ($ints) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints, true)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs, true)) {
                return true;
            }
            if (in_array($object_term->slug, $strs, true)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 5.5

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int              $object_id ID of the object (post ID, link ID, ...).
 * @param string           $taxonomy  Single taxonomy name.
 * @param int|string|array $terms     Optional. Term term_id, name, slug or array of said. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    $object_id = (int) $object_id;
    if (!$object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID.'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy, array('update_term_meta_cache' => false));
        if (is_wp_error($object_terms)) {
            return $object_terms;
        }
        wp_cache_set($object_id, wp_list_pluck($object_terms, 'term_id'), "{$taxonomy}_relationships");
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    $ints = array_filter($terms, 'is_int');
    if ($ints) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints, true)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs, true)) {
                return true;
            }
            if (in_array($object_term->slug, $strs, true)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 5.3

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int              $object_id ID of the object (post ID, link ID, ...).
 * @param string           $taxonomy  Single taxonomy name.
 * @param int|string|array $terms     Optional. Term term_id, name, slug or array of said. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    $object_id = (int) $object_id;
    if (!$object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID.'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy, array('update_term_meta_cache' => false));
        if (is_wp_error($object_terms)) {
            return $object_terms;
        }
        wp_cache_set($object_id, wp_list_pluck($object_terms, 'term_id'), "{$taxonomy}_relationships");
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    $ints = array_filter($terms, 'is_int');
    if ($ints) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 4.9

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int              $object_id ID of the object (post ID, link ID, ...).
 * @param string           $taxonomy  Single taxonomy name.
 * @param int|string|array $terms     Optional. Term term_id, name, slug or array of said. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    if (!$object_id = (int) $object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID.'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy, array('update_term_meta_cache' => false));
        if (is_wp_error($object_terms)) {
            return $object_terms;
        }
        wp_cache_set($object_id, wp_list_pluck($object_terms, 'term_id'), "{$taxonomy}_relationships");
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    if ($ints = array_filter($terms, 'is_int')) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 6.1

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int              $object_id ID of the object (post ID, link ID, ...).
 * @param string           $taxonomy  Single taxonomy name.
 * @param int|string|array $terms     Optional. Term term_id, name, slug or array of said. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    if (!$object_id = (int) $object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy, array('update_term_meta_cache' => false));
        if (is_wp_error($object_terms)) {
            return $object_terms;
        }
        wp_cache_set($object_id, wp_list_pluck($object_terms, 'term_id'), "{$taxonomy}_relationships");
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    if ($ints = array_filter($terms, 'is_int')) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 4.6

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int              $object_id ID of the object (post ID, link ID, ...).
 * @param string           $taxonomy  Single taxonomy name.
 * @param int|string|array $terms     Optional. Term term_id, name, slug or array of said. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    if (!$object_id = (int) $object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy, array('update_term_meta_cache' => false));
        wp_cache_set($object_id, wp_list_pluck($object_terms, 'term_id'), "{$taxonomy}_relationships");
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    if ($ints = array_filter($terms, 'is_int')) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 4.4

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int              $object_id ID of the object (post ID, link ID, ...).
 * @param string           $taxonomy  Single taxonomy name.
 * @param int|string|array $terms     Optional. Term term_id, name, slug or array of said. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    if (!$object_id = (int) $object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy, array('update_term_meta_cache' => false));
        wp_cache_set($object_id, $object_terms, "{$taxonomy}_relationships");
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    if ($ints = array_filter($terms, 'is_int')) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 4.3

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int              $object_id ID of the object (post ID, link ID, ...).
 * @param string           $taxonomy  Single taxonomy name.
 * @param int|string|array $terms     Optional. Term term_id, name, slug or array of said. Default null.
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    if (!$object_id = (int) $object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy);
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    if ($ints = array_filter($terms, 'is_int')) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 4.2

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int $object_id ID of the object (post ID, link ID, ...)
 * @param string $taxonomy Single taxonomy name
 * @param int|string|array $terms Optional. Term term_id, name, slug or array of said
 * @return bool|WP_Error WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    if (!$object_id = (int) $object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy);
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    if ($ints = array_filter($terms, 'is_int')) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 4.1

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 *
 * @param int $object_id ID of the object (post ID, link ID, ...)
 * @param string $taxonomy Single taxonomy name
 * @param int|string|array $terms Optional. Term term_id, name, slug or array of said
 * @return bool|WP_Error. WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    if (!$object_id = (int) $object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy);
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    if ($ints = array_filter($terms, 'is_int')) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        // If term is an int, check against term_ids only.
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        if ($strs) {
            // Only check numeric strings against term_id, to avoid false matches due to type juggling.
            $numeric_strs = array_map('intval', array_filter($strs, 'is_numeric'));
            if (in_array($object_term->term_id, $numeric_strs, true)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}

WordPress Version: 3.7

/**
 * Determine if the given object is associated with any of the given terms.
 *
 * The given terms are checked against the object's terms' term_ids, names and slugs.
 * Terms given as integers will only be checked against the object's terms' term_ids.
 * If no terms are given, determines if object is associated with any terms in the given taxonomy.
 *
 * @since 2.7.0
 * @uses get_object_term_cache()
 * @uses wp_get_object_terms()
 *
 * @param int $object_id ID of the object (post ID, link ID, ...)
 * @param string $taxonomy Single taxonomy name
 * @param int|string|array $terms Optional. Term term_id, name, slug or array of said
 * @return bool|WP_Error. WP_Error on input error.
 */
function is_object_in_term($object_id, $taxonomy, $terms = null)
{
    if (!$object_id = (int) $object_id) {
        return new WP_Error('invalid_object', __('Invalid object ID'));
    }
    $object_terms = get_object_term_cache($object_id, $taxonomy);
    if (false === $object_terms) {
        $object_terms = wp_get_object_terms($object_id, $taxonomy);
    }
    if (is_wp_error($object_terms)) {
        return $object_terms;
    }
    if (empty($object_terms)) {
        return false;
    }
    if (empty($terms)) {
        return !empty($object_terms);
    }
    $terms = (array) $terms;
    if ($ints = array_filter($terms, 'is_int')) {
        $strs = array_diff($terms, $ints);
    } else {
        $strs =& $terms;
    }
    foreach ($object_terms as $object_term) {
        if ($ints && in_array($object_term->term_id, $ints)) {
            return true;
        }
        // If int, check against term_id
        if ($strs) {
            if (in_array($object_term->term_id, $strs)) {
                return true;
            }
            if (in_array($object_term->name, $strs)) {
                return true;
            }
            if (in_array($object_term->slug, $strs)) {
                return true;
            }
        }
    }
    return false;
}