map_meta_cap()判断当前用户是否有某个权限

目录

描述

Map meta capabilities to primitive capabilities.

This does not actually compare whether the user ID has the actual capability,
just what the capability or capabilities are. Meta capability list value can
be one of the following:

  • 'delete_page'
  • 'delete_post'
  • 'delete_user'
  • 'edit_comment' (3.1. Mapped to 'edit_post' meta capability.)
  • 'edit_page'
  • 'edit_post'
  • 'edit_user'
  • 'publish_post' (3.5)
  • 'promote_user'
  • 'read_post'
  • 'read_page'
  • 'remove_user'

map_meta_cap() 描述

参数

$cap

(string) (必填) Capability name.

默认值: None

$user_id

(integer) (必填) User ID.

默认值: None

map_meta_cap() 参数

返回值

(array) 

Actual capabilities for meta capability.

map_meta_cap() 返回值

历史

  • 3.5.0: Add 'publish_post' meta cap
  • 添加于 版本: 2.0

map_meta_cap() 历史