W3cubDocs

/WordPress

get_the_tags( int $id )

Retrieve the tags for a post.

Description

Parameters

$id

(int) (Required) Post ID.

Return

(array|false|WP_Error) Array of tag objects on success, false on failure.

Source

File: wp-includes/category-template.php

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' ) );
}

Changelog

Version Description
2.3.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_the_tags