get_the_author_meta()WP 2.8.0

Retrieves the requested data of the current or requested user (post author).

No need to specify user ID if the function used inside The Loop, it returns the data of current post author, in this case. You need to specify the user ID only if the function is used outside The Loop.

To immediately display the data, use the_author_meta().

Some plugins can extend the user data (such data adds to wp_usermeta table specifying key & value). To get such new field value specify the name (key) of this new field.

1 time — 0.000001 sec (speed of light) | 50000 times — 0.01 sec (speed of light) | PHP 7.3.12, WP 5.3.2
Hooks from the function


String. User data, if it exists, otherwise an empty string.


get_the_author_meta( $field, $user_id );

The user field to retrieve. Can be:

user_login          | login
user_pass           | pass
user_nicename       | nicename
user_email          | email
user_url            | url
user_registered     | registered
user_activation_key | activation_key
user_status         | status
user_description    | description (Биографические данные из профиля пользователя)
user_firstname      | first_name
user_lastname       | last_name
user_level          | $wpdb->prefix . 'user_level'

Default: ''

User ID. If specify this parameter, then the function returns data of the specified user (author).
Default: false (current user/author data)



#1 Retrieve the user e-mail

Let's get the email of the current post author and place it in the $user_email variable to use it further in our code (remember that the function is retrieve the data. but not display it).

$user_email = get_the_author_meta( 'user_email' );
echo $user_email;

Note: if you retrieve the data on the separated single page, before the function call you need to call the_post() function, or you need to specify user ID in second parameter ($post->post_author).


#2 Retrieve user name and link to email.

Let's get e-mail of the user with ID = 25 and display his "display name":

<p>Write to the author's email: 
	<a href="mailto:<?php echo get_the_author_meta('user_email', 25); ?>">
		<?php the_author_meta('display_name', 25); ?>


  • Global. WP_User. $authordata The current author's data.


Since 2.8.0 Introduced.

get_the_author_meta() code WP 6.4.3

function get_the_author_meta( $field = '', $user_id = false ) {
	$original_user_id = $user_id;

	if ( ! $user_id ) {
		global $authordata;
		$user_id = isset( $authordata->ID ) ? $authordata->ID : 0;
	} else {
		$authordata = get_userdata( $user_id );

	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ), true ) ) {
		$field = 'user_' . $field;

	$value = isset( $authordata->$field ) ? $authordata->$field : '';

	 * Filters the value of the requested user metadata.
	 * The filter name is dynamic and depends on the $field parameter of the function.
	 * @since 2.8.0
	 * @since 4.3.0 The `$original_user_id` parameter was added.
	 * @param string    $value            The value of the metadata.
	 * @param int       $user_id          The user ID for the value.
	 * @param int|false $original_user_id The original user ID, as passed to the function.
	return apply_filters( "get_the_author_{$field}", $value, $user_id, $original_user_id );