wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



get_tags › WordPress Function

Depuis2.3.0
Dépréciéen/a
› get_tags ( $args = '' )
Paramètres:
  • (string|array) $args { Optional. Arguments to retrieve tags. See get_terms() for additional options. @type string $taxonomy Taxonomy to retrieve terms for. Default 'post_tag'. }
    Requis: Non
    Défaut: (vide)
Retourne:
  • (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.
Défini(e) dans:
Codex:

Retrieves all post tags.



Fonctions en relation: get_tag, get_pages, get_the_tags, get_page, the_tags

Source

function get_tags( $args = '' ) {
	$defaults = array( 'taxonomy' => 'post_tag' );
	$args     = wp_parse_args( $args, $defaults );

	$tags = get_terms( $args );

	if ( empty( $tags ) ) {
		$tags = array();
	} else {
		/**
		 * Filters the array of term objects returned for the 'post_tag' taxonomy.
		 *
		 * @since 2.3.0
		 *
		 * @param WP_Term[]|int|WP_Error $tags Array of 'post_tag' term objects, a count thereof,
		 *                                     or WP_Error if any of the taxonomies do not exist.
		 * @param array                  $args An array of arguments. See {@see get_terms()}.
		 */
		$tags = apply_filters( 'get_tags', $tags, $args );
	}

	return $tags;
}