get_the_tags
Retrieve the tags for a post.
Description
(array|false|WP_Error) get_the_tags( (int) $id = 0 );
Returns (array|false|WP_Error)
Array of tag objects on success, false on failure.
Parameters (1)
- 0. $id — Optional. (int)
- Post ID.
Usage
if ( !function_exists( 'get_the_tags' ) ) { require_once ABSPATH . WPINC . '/category-template.php'; } // Post ID. $id = -1; // NOTICE! Understand what this does before running. $result = get_the_tags($id);
Defined (1)
The function is defined in the following location(s).
- /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 array $terms An array of tags for the given post.
- */
- }