函数
the_author ( $deprecated = '', $deprecated_echo = true )
- 参数
-
-
(string)
$deprecated
Deprecated.- Required: 否
- Default: (empty)
-
(bool)
$deprecated_echo
Deprecated. Use get_the_author(). Echo the string or return it.- Required: 否
- Default: true
-
(string)
- 返回值
-
- (string|null) The author’s display name, from get_the_author().
- 相关
-
- get_the_author()
- 定义位置
-
-
wp-includes/author-template.php
, line 60
-
wp-includes/author-template.php
- 引入
- 0.71
- 弃用
- –
Displays the name of the author of the current post.
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.
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.' ),
'get_the_author()
'
)
);
}
if ( $deprecated_echo ) {
echo get_the_author();
}
return get_the_author();
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。