get_the_tags

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

WordPress Version: 6.1

/**
 * Retrieves the tags for a post.
 *
 * @since 2.3.0
 *
 * @param int|WP_Post $post Post ID or object.
 * @return WP_Term[]|false|WP_Error Array of WP_Term objects on success, false if there are no terms
 *                                  or the post does not exist, WP_Error on failure.
 */
function get_the_tags($post = 0)
{
    $terms = get_the_terms($post, 'post_tag');
    /**
     * Filters the array of tags for the given post.
     *
     * @since 2.3.0
     *
     * @see get_the_terms()
     *
     * @param WP_Term[]|false|WP_Error $terms Array of WP_Term objects on success, false if there are no terms
     *                                        or the post does not exist, WP_Error on failure.
     */
    return apply_filters('get_the_tags', $terms);
}

WordPress Version: 5.6

/**
 * Retrieves the tags for a post.
 *
 * @since 2.3.0
 *
 * @param int|WP_Post $post_id Post ID or object.
 * @return WP_Term[]|false|WP_Error Array of WP_Term objects on success, false if there are no terms
 *                                  or the post does not exist, WP_Error on failure.
 */
function get_the_tags($post_id = 0)
{
    $terms = get_the_terms($post_id, 'post_tag');
    /**
     * Filters the array of tags for the given post.
     *
     * @since 2.3.0
     *
     * @see get_the_terms()
     *
     * @param WP_Term[]|false|WP_Error $terms Array of WP_Term objects on success, false if there are no terms
     *                                        or the post does not exist, WP_Error on failure.
     */
    return apply_filters('get_the_tags', $terms);
}

WordPress Version: 5.5

/**
 * Retrieves the tags for a post.
 *
 * @since 2.3.0
 *
 * @param int $post_id Post ID.
 * @return array|false|WP_Error Array of tag objects on success, false on failure.
 */
function get_the_tags($post_id = 0)
{
    $terms = get_the_terms($post_id, 'post_tag');
    /**
     * Filters the array of tags for the given post.
     *
     * @since 2.3.0
     *
     * @see get_the_terms()
     *
     * @param WP_Term[] $terms An array of tags for the given post.
     */
    return apply_filters('get_the_tags', $terms);
}

WordPress Version: 5.1

/**
 * Retrieve the tags for a post.
 *
 * @since 2.3.0
 *
 * @param int $id Post ID.
 * @return array|false|WP_Error Array of tag objects on success, false on failure.
 */
function get_the_tags($id = 0)
{
    /**
     * Filters the array of tags for the given post.
     *
     * @since 2.3.0
     *
     * @see get_the_terms()
     *
     * @param WP_Term[] $terms An array of tags for the given post.
     */
    return apply_filters('get_the_tags', get_the_terms($id, 'post_tag'));
}

WordPress Version: 4.6

/**
 * Retrieve the tags for a post.
 *
 * @since 2.3.0
 *
 * @param int $id Post ID.
 * @return array|false|WP_Error Array of tag objects on success, false on failure.
 */
function get_the_tags($id = 0)
{
    /**
     * Filters the array of tags for the given post.
     *
     * @since 2.3.0
     *
     * @see get_the_terms()
     *
     * @param array $terms An array of tags for the given post.
     */
    return apply_filters('get_the_tags', get_the_terms($id, 'post_tag'));
}

WordPress Version: 4.3

/**
 * Retrieve the tags for a post.
 *
 * @since 2.3.0
 *
 * @param int $id Post ID.
 * @return array|false|WP_Error Array of tag objects on success, false on failure.
 */
function get_the_tags($id = 0)
{
    /**
     * Filter the array of tags for the given post.
     *
     * @since 2.3.0
     *
     * @see get_the_terms()
     *
     * @param array $terms An array of tags for the given post.
     */
    return apply_filters('get_the_tags', get_the_terms($id, 'post_tag'));
}

WordPress Version: 3.9

/**
 * Retrieve the tags for a post.
 *
 * @since 2.3.0
 *
 * @param int $id Post ID.
 * @return array|bool Array of tag objects on success, false on failure.
 */
function get_the_tags($id = 0)
{
    /**
     * Filter the array of tags for the given post.
     *
     * @since 2.3.0
     *
     * @see get_the_terms()
     *
     * @param array $terms An array of tags for the given post.
     */
    return apply_filters('get_the_tags', get_the_terms($id, 'post_tag'));
}

WordPress Version: 3.7

/**
 * Retrieve the tags for a post.
 *
 * @since 2.3.0
 * @uses apply_filters() Calls 'get_the_tags' filter on the list of post tags.
 *
 * @param int $id Post ID.
 * @return array|bool Array of tag objects on success, false on failure.
 */
function get_the_tags($id = 0)
{
    return apply_filters('get_the_tags', get_the_terms($id, 'post_tag'));
}