get_profile() - WordPress 函数参考中文文档

返回介绍

get_profile()

发布于 2017-09-11 字数1640 浏览 949 评论 0

Warning: This function has been deprecated. Use get_the_author_meta() instead.

get_profile( string $field,  false|int $user = false )

Retrieve user data based on field.


描述


参数

$field

(string)
(Required)
User meta field.

$user

(false|int)
(Optional)
User ID to retrieve the field for. Default false (current user).

Default value: 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 描述
3.0.0 Use get_the_author_meta()
1.5.0 Introduced.

相关函数

Uses

  • wp-includes/pluggable.php:
    get_user_by()
  • wp-includes/functions.php:
    _deprecated_function()
  • wp-includes/author-template.php:
    get_the_author_meta()

User Contributed Notes

上一篇:get_private_posts_cap_sql()

下一篇:get_pung()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!