Codex tools: Log in / create account
Languages: English • 日本語 • Türkçe • (Add your language)
Contents |
The the_author_meta Template Tag displays the desired meta data for a user. If this tag is used within The Loop, the user ID value need not be specified, and the displayed data is that of the current post author. A user ID can be specified if this tag is used outside The Loop.
NOTE: Use get_the_author_meta() if you need to return (not display) the information.
<?php the_author_meta( $field, $userID ); ?>
Displays the value in the author's AIM (AOL Instant Messenger screenname) field.
<p>This author's AIM address is <?php the_author_meta('aim'); ?></p>
Displays the email address for user ID 25.
<p>The email address for user id 25 is <?php the_author_meta('user_email',25); ?></p>
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>This author's Twitter name is <?php the_author_meta('twitter'); ?></p>
would return
<p>This author's Twitter name is wordpress</p>
Since: 2.8.0
the_author_meta() is located in wp-includes/author-template.php.
the_author, the_author_link, the_author_posts, the_author_posts_link, wp_list_authors, wp_dropdown_users, the_author_meta