WordPress at a glance

get_the_tags() WP 1.0

Retrieve the tags for a post.

Works based on: get_the_terms()
Hooks from function:
Return

Array/false/WP_Error. Array of tag objects on success, false on failure.

Usage

get_the_tags( $id );
$id(int)
Post ID.
Default: 0

Code of get_the_tags: wp-includes/category-template.php VER 4.9.8

<?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 array $terms An array of tags for the given post.
	 */
	return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) );
}

Related Functions

From tag: WP Loop

More from category: For posts

No comments
    Hello, !     Log In . Register