函数文档

check_import_new_users()

💡 云策文档标注

概述

check_import_new_users() 函数用于检查当前用户是否具有导入新用户的权限。它基于 WordPress 的多站点网络用户管理能力进行权限验证。

关键要点

  • 函数检查当前用户是否拥有 'manage_network_users' 能力
  • 返回布尔值:true 表示有权限,false 表示无权限
  • 参数 $permission 当前未使用,但保留为函数接口的一部分

代码示例

function check_import_new_users( $permission ) {
	if ( ! current_user_can( 'manage_network_users' ) ) {
		return false;
	}

	return true;
}

注意事项

  • 此函数自 WordPress 3.0.0 版本引入
  • 与 current_user_can() 函数相关,用于检查用户能力
  • 主要用于多站点网络环境中的用户导入权限控制

📄 原文内容

Checks if the current user has permissions to import new users.

Parameters

$permissionstringrequired
A permission to be checked. Currently not used.

Return

bool True if the user has proper permissions, false if they do not.

Source

function check_import_new_users( $permission ) {
	if ( ! current_user_can( 'manage_network_users' ) ) {
		return false;
	}

	return true;
}

Changelog

Version Description
3.0.0 Introduced.