Languages: English • 日本語 Türkçe • (Add your language)
The the_author_meta Template Tag displays a desired meta data field for a user. Only one field is returned at a time, you need to specify which you want.
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.
If the meta field does not exist, nothing is printed.
NOTE: Use get_the_author_meta()
if you need to return (and do something with) the field, rather than just display it.
<?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 table (where wp_ is your data base prefix). For this example we will use a Twitter ID. For a meta_key value of "twitter" and meta_value of "WordPress" then
<p>This author's Twitter name is <?php the_author_meta('twitter'); ?></p>
would return
This author's Twitter name is WordPress
Since: 2.8.0
the_author_meta() is located in wp-includes/author-template.php
.
the_author(), get_the_author(), get_the_author_id(), the_author_link(), get_the_author_link(), the_author_meta(), get_the_author_meta(), the_author_posts(), get_the_author_posts(), the_author_posts_link(), get_author_posts_url(), get_the_modified_author(), the_modified_author(), wp_dropdown_users(), wp_list_authors()