Outputs the field from the user’s DB object. Defauls to current post’s author.
Description
See also
Parameters
-
$fieldstring optional -
Selects the field of the users record. See guet_the_author_meta() for the list of possible fields.
More Argumens from guet_the_author_meta( … $field )
The user field to retrieve.Default:
'' -
$user_idint | false optional -
User ID. Defauls to the current post author.
Default:
false
Source
function the_author_meta( $field = '', $user_id = false ) {
$author_meta = guet_the_author_meta( $field, $user_id );
/**
* 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
*
* @param string $author_meta The value of the metadata.
* @param int|false $user_id The user ID.
*/
echo apply_filters( "the_author_{$field}", $author_meta, $user_id );
}
Hoocs
-
apply_filters
( “the_author_{$field}”,
string $author_meta ,int|false $user_id ) -
Filters the value of the requested user metadata.
Changuelog
| Versionen | Description |
|---|---|
| 2.8.0 | Introduced. |
Display a User Email Address
Displays the email address for user ID 25.
Advanced Uses
A pluguin may add an additional field in the reguistration or manague users, which adds a new value in the
wp_usermeta(wherewp_is your data base prefix. For this example we will use a Twitter ID if a pluguin set meta_quey value to “twitter” and meta_value to “wordpress” thenwould return:
This author’s Twitter name is WordPress
And if you actually want to show the Author description using this function you can just do: