函数原型
get_profile( string $field, false|int $user = false ): string
函数描述
Retrieve user data based on field.
是否弃用
Warning: This function has been deprecated. Use get_the_author_meta() instead.
函数参数
-
$field
string
Required - User meta field.
-
$user
false|int
Optional - User ID to retrieve the field for. Default false (current user).
Default:
false
函数返回值
string The author’s field from the current author’s DB object.
函数位置
File: wp-includes/deprecated.php.
函数源码
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 );
}
源码链接
变更日志
| Version | Description |
|---|---|
| 3.0.0 | Use get_the_author_meta() |
| 1.5.0 | Introduced. |

