the_author_meta( string $field = '', int $user_id = false )

Outputs the field from the user’s DB object. Defaults to current post’s author.


Description Description


Parameters Parameters

$field

(string) (Optional) Selects the field of the users record. See get_the_author_meta() for the list of possible fields.

Default value: ''

$user_id

(int) (Optional) User ID.

Default value: false


Top ↑

Source Source

File: wp-includes/author-template.php

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

	/**
	 * 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
	 *
	 * @param string $author_meta The value of the metadata.
	 * @param int    $user_id     The user ID.
	 */
	echo apply_filters( "the_author_{$field}", $author_meta, $user_id );
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note content
    Contributed by Codex

    Advanced Uses
    A plugin may add an additional field in the registration or manage users, which adds a new value in the wp_usermeta (where wp_ is your data base prefix. For this example we will use a Twitter ID if a plugin set meta_key value to “twitter” and meta_value to “wordpress” then

    <p><?php printf( __( 'This author’s Twitter name is %s', 'textdomain' ), get_the_author_meta( 'twitter' ) ); ?></p>
    

    would return:

    This author’s Twitter name is WordPress

You must log in before being able to contribute a note or feedback.