get_the_author_<field>

Filters the value of the requested user metadata.

Description

apply_filters( 'get_the_author_<field>', (string) $value, (int) $user_id, (int|bool) $original_user_id ); 

The filter name is dynamic and depends on the $field parameter of the function.

Parameters (3)

0. $value (string)
The value of the metadata.
1. $user_id (int)
The user ID for the value.
2. $original_user_id (int|bool)
The original user ID, as passed to the function.

Usage

To run the hook, copy the example below.
  1. $value = apply_filters( 'get_the_author_{$field}', $value, $user_id, $original_user_id ); 
  2.  
  3. if ( !empty( $value ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the get_the_author_<field> callback 
  2. function filter_get_the_author_field( $value, $user_id, $original_user_id ) { 
  3. // make filter magic happen here... 
  4. return $value
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "get_the_author_{$field}", 'filter_get_the_author_field', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "get_the_author_{$field}", 'filter_get_the_author_field', 10, 3 ); 

Defined (1)

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

/wp-includes/author-template.php  
  1. return apply_filters( 'get_the_author_' . $field, $value, $user_id, $original_user_id );