get_profile

函式
get_profile ( $field, $user = false )
引數
  • (string) $field User meta field.
    Required:
  • (false|int) $user Optional. User ID to retrieve the field for. Default false (current user).
    Required:
    Default: false
返回值
  • (string) The author's field from the current author's DB object.
相關
  • get_the_author_meta()
定義位置
相關方法
get_roleget_post_fieldget_edit_profile_urlget_plugin_filesget_file_data
引入
1.5.0
棄用
3.0.0

get_profile函式是一個WordPress函式,用於檢索特定使用者的使用者資料欄位: 這個函式以使用者ID為引數,返回一個使用者配置檔案欄位的陣列。

根據欄位檢索使用者資料。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_profile( $field, $user = false ) {
_deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' );
if ( $user ) {
$user = get_user_by( 'login', $user );
$user = $user->ID;
}
return get_the_author_meta( $field, $user );
}
function get_profile( $field, $user = false ) { _deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' ); if ( $user ) { $user = get_user_by( 'login', $user ); $user = $user->ID; } return get_the_author_meta( $field, $user ); }
function get_profile( $field, $user = false ) {
	_deprecated_function( __FUNCTION__, '3.0.0', 'get_the_author_meta()' );
	if ( $user ) {
		$user = get_user_by( 'login', $user );
		$user = $user->ID;
	}
	return get_the_author_meta( $field, $user );
}

常見問題

FAQs
檢視更多 >