get_tags

Retrieves all post tags.

Description

(array) get_tags( (string) $args = '' ); 

Returns (array)

List of tags.

Parameters (1)

0. $args — Optional. (string) => ''
Tag arguments to use when retrieving tags.

Usage

  1. if ( !function_exists( 'get_tags' ) ) { 
  2. require_once ABSPATH . WPINC . '/category.php'; 
  3.  
  4. // Tag arguments to use when retrieving tags. 
  5. $args = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_tags($args); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/category.php  
  1. function get_tags( $args = '' ) { 
  2. $tags = get_terms( 'post_tag', $args ); 
  3.  
  4. if ( empty( $tags ) ) { 
  5. $return = array(); 
  6. return $return; 
  7.  
  8. /** 
  9. * Filters the array of term objects returned for the 'post_tag' taxonomy. 
  10. * @since 2.3.0 
  11. * @param array $tags Array of 'post_tag' term objects. 
  12. * @param array $args An array of arguments. @see get_terms() 
  13. */ 
  14. $tags = apply_filters( 'get_tags', $tags, $args ); 
  15. return $tags;