get_the_author() WP 1.5
Получает имя (display_name) автора поста. Используется внутри цикла WordPress.
Основа для: get_the_author_posts_link(), the_author()
Хуки из функции
Возвращает
Строку. Отображаемое имя автора (display_name).
Использование
$author = get_the_author();
Примеры
#1 Выведем "публичное" имя автора:
echo get_the_author();
Заметки
- Global. WP_User. $authordata The current author's data.
Список изменений
С версии 1.5.0 | Введена. |
Код get_the_author() get the author WP 5.6.2
function get_the_author( $deprecated = '' ) {
global $authordata;
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.1.0' );
}
/**
* Filters the display name of the current post's author.
*
* @since 2.9.0
*
* @param string|null $display_name The author's display name.
*/
return apply_filters( 'the_author', is_object( $authordata ) ? $authordata->display_name : null );
}