get_the_author

函式
get_the_author ( $deprecated = '' )
引數
  • (string) $deprecated Deprecated.
    Required:
    Default: (empty)
返回值
  • (string|null) The author's display name.
定義位置
相關方法
get_the_author_idget_the_author_aimget_the_author_urlget_the_author_yimget_the_author_msn
引入
1.5.0
棄用
-

get_the_author: 這個函式檢索當前文章或頁面作者的顯示名稱。它不需要任何引數,以字串形式返回作者的名字。

檢索當前文章的作者。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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 );
}
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 ); }
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 );
}

常見問題

FAQs
檢視更多 >