the_author_meta

函式
the_author_meta ( $field = '', $user_id = false )
引數
  • (string) $field Selects the field of the users record. See get_the_author_meta() for the list of possible fields.
    Required:
    Default: (empty)
  • (int|false) $user_id Optional. User ID.
    Required:
    Default: false
相關
  • get_the_author_meta()
定義位置
相關方法
get_the_author_metathe_author_emailthe_author_msnthe_author_yimthe_author_aim
引入
2.8.0
棄用
-

the_author_meta: 此函式顯示當前文章的作者或指定使用者的指定元欄位。

從使用者的DB物件中輸出該欄位。預設為當前文章的作者。

function the_author_meta( $field = '', $user_id = false ) {
	$author_meta = get_the_author_meta( $field, $user_id );

	/**
	 * 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
	 *
	 * @param string    $author_meta The value of the metadata.
	 * @param int|false $user_id     The user ID.
	 */
	echo apply_filters( "the_author_{$field}", $author_meta, $user_id );
}

常見問題

FAQs
檢視更多 >