W3cubDocs

/WordPress

get_tags( string|array $args = '' )

Retrieves all post tags.

Description

See also

Parameters

$args

(string|array) (Optional) Tag arguments to use when retrieving tags.

Default value: ''

Return

(WP_Term[]|int) $tags Array of 'post_tag' term objects, or a count thereof.

Source

File: wp-includes/category.php

function get_tags( $args = '' ) {
	$tags = get_terms( 'post_tag', $args );

	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

Version Description
2.3.0 Introduced.

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