the_author()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
the_author( string $deprecated = '', bool $deprecated_echo = true ): string
Описание
Поведение этой функции основано на старой функциональности, появившейся до get_the_author() . Функция не является устаревшей, но предназначена для вывода значения из get_the_author() , и поэтому в любой старой теме, которая всё ещё может использовать прежнее поведение, также будет передано значение из get_the_author() .
Обычное, ожидаемое поведение этой функции — вывести автора, а не вернуть его. Однако необходимо сохранять обратную совместимость.
См. alsoget_the_author()
Оригинал (английский)
The behavior of this function is based off of old functionality predating get_the_author() . This function is not deprecated, but is designed to echo the value from get_the_author() and as an result of any old theme that might still use the old behavior will also pass the value from get_the_author() .
The normal, expected behavior of this function is to echo the author and not return it. However, backward compatibility has to be maintained.
Параметры
$deprecated
string
необязательный
= ''
$deprecated_echo
bool
необязательный
= true
Возвращаемое значение
string
Исходный код
wp-includes/author-template.php:61
function the_author( $deprecated = '', $deprecated_echo = true ) {
if ( ! empty( $deprecated ) ) {
_deprecated_argument( __FUNCTION__, '2.1.0' );
}
if ( true !== $deprecated_echo ) {
_deprecated_argument(
__FUNCTION__,
'1.5.0',
sprintf(
/* translators: %s: get_the_author() */
__( 'Use %s instead if you do not want the value echoed.' ),
'<code>get_the_author()</code>'
)
);
}
if ( $deprecated_echo ) {
echo get_the_author();
}
return get_the_author();
}
История изменений
| Версия | Описание |
|---|---|
| 0.71 | Introduced. |

