the_tags

Filters the tags list for a given post.

Description

apply_filters( 'the_tags', (string) $get_the_term_list, (string) $before, (string) $sep, (string) $after, (int) $id ); 

Parameters (5)

0. $get_the_term_list (string) => get_the_term_list( $id, 'post_tag', $before, $sep, $after )
The get the term list.
1. $before (string)
String to use before tags.
2. $sep (string)
String to use between the tags.
3. $after (string)
String to use after tags.
4. $id (int)
Post ID.

Usage

To run the hook, copy the example below.
  1. $get_the_term_list = apply_filters( 'the_tags', $get_the_term_list, $before, $sep, $after, $id ); 
  2.  
  3. if ( !empty( $get_the_term_list ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the the_tags callback 
  2. function filter_the_tags( $get_the_term_list, $before, $sep, $after, $id ) { 
  3. // make filter magic happen here... 
  4. return $get_the_term_list
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'the_tags', 'filter_the_tags', 10, 5 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'the_tags', 'filter_the_tags', 10, 5 ); 

Defined (1)

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

/wp-includes/category-template.php  
  1. return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );