The get_the_author_{$field} WordPress PHP filter allows you to modify the value of the requested user metadata. The filter name is dynamic and depends on the $field
parameter of the function.
Usage
add_filter( 'get_the_author_meta', function( $value, $user_id, $original_user_id ) { // your custom code here return $value; }, 10, 3 );
Parameters
$value
(string) – The value of the metadata.$user_id
(int) – The user ID for the value.$original_user_id
(int|false) – The original user ID, as passed to the function.
More information
See WordPress Developer Resources: get_the_author_{$field}
Examples
Change display name to uppercase
This example changes the display name of the author to uppercase.
add_filter( 'get_the_author_display_name', function( $value, $user_id, $original_user_id ) { return strtoupper( $value ); }, 10, 3 );
Add prefix to user email
This example adds a prefix to the author’s email.
add_filter( 'get_the_author_user_email', function( $value, $user_id, $original_user_id ) { return 'prefix_' . $value; }, 10, 3 );
Modify user URL
This example adds a custom path to the author’s URL.
add_filter( 'get_the_author_user_url', function( $value, $user_id, $original_user_id ) { return $value . '/custom-path'; }, 10, 3 );
Change author’s first name
This example changes the author’s first name to “John”.
add_filter( 'get_the_author_first_name', function( $value, $user_id, $original_user_id ) { return 'John'; }, 10, 3 );
Append text to author’s description
This example appends custom text to the author’s description.
add_filter( 'get_the_author_description', function( $value, $user_id, $original_user_id ) { return $value . ' - Custom text'; }, 10, 3 );