WordPress开发者和主题制作者的搜索引擎



set_current_user ›

Since2.0.1
已弃用3.0.0
set_current_user ( $id, $name = '' )
参数: (2)
  • (int|null) $id User ID.
    Required: Yes
  • (string) $name Optional. The user's username
    Required: No
    默认: (empty)
查看:
返回:
  • (WP_User) returns wp_set_current_user()
定义在:
文档:

Changes the current user by ID or name.

Set $id to null and specify a name if you do not know a user's ID.



源码

function set_current_user($id, $name = '') {
	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' );
	return wp_set_current_user($id, $name);
}