get_the_author_meta()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
get_the_author_meta( string $field = '', int|false $user_id = false ): string
Описание
Допустимые значения параметра $field :
admin_color
comment_shortcuts
description
display_name
first_name
ID
last_name
nickname
plugins_last_view
plugins_per_page
rich_editing
syntax_highlighting
user_activation_key
user_description
user_email
user_firstname
user_lastname
user_level
user_login
user_nicename
user_pass
user_registered
user_status
user_url
Оригинал (английский)
Valid values for the $field parameter include:
- admin_color
- comment_shortcuts
- description
- display_name
- first_name
- ID
- last_name
- nickname
- plugins_last_view
- plugins_per_page
- rich_editing
- syntax_highlighting
- user_activation_key
- user_description
- user_email
- user_firstname
- user_lastname
- user_level
- user_login
- user_nicename
- user_pass
- user_registered
- user_status
- user_url
Параметры
$field
string
необязательный
= ''
$user_id
int|false
необязательный
= false
Возвращаемое значение
string
Исходный код
wp-includes/author-template.php:167
function get_the_author_meta( $field = '', $user_id = false ) {
$original_user_id = $user_id;
if ( ! $user_id ) {
global $authordata;
$user_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 = $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 );
}
История изменений
| Версия | Описание |
|---|---|
| 6.9.0 | Removed aim, jabber, and yim as valid values for the $field parameter. |
| 2.8.0 | Introduced. |

