Summery Summery

Retrieves all post tags.

Syntax Syntax

get_tags( string|array $args = '' )

Parameters Parameters


(string|array) (Optional) Arguments to retrieve tags. See get_terms() for additional options.

  • 'taxonomy'
    (string) Taxonomy to retrieve terms for. Default 'post_tag'.

Default value: ''

Return Return

(WP_Term[]|int|WP_Error) Array of 'post_tag' term objects, a count thereof, or WP_Error if any of the taxonomies do not exist.

Source Source

File: wp-includes/category.php

	if ( empty( $tags ) ) {
		$return = array();
		return $return;

	 * Filters the array of term objects returned for the 'post_tag' taxonomy.
	 * @since 2.3.0
	 * @param WP_Term[]|int $tags Array of 'post_tag' term objects, or a count thereof.
	 * @param array         $args An array of arguments. @see get_terms()
	$tags = apply_filters( 'get_tags', $tags, $args );
	return $tags;



Changelog Changelog

Version Description
2.3.0 Introduced.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.