map_meta_cap filter-hook . WP 2.8.0
Filters a user's capabilities depending on specific context and/or privilege.
Usage
add_filter( 'map_meta_cap', 'filter_function_name_3932', 10, 4 ); function filter_function_name_3932( $caps, $cap, $user_id, $args ){ // filter... return $caps; }
- $caps(string[])
- Array of the user's capabilities.
- $cap(string)
- Capability name.
- $user_id(int)
- The user ID.
- $args(array)
- Adds the context to the cap. Typically the object ID.
Changelog
Since 2.8.0 | Introduced. |
Where the hook is called
map_meta_cap
wp-includes/capabilities.php 634
return apply_filters( 'map_meta_cap', $caps, $cap, $user_id, $args );
Where in WP core the hook is used WordPress
wp-includes/capabilities.php 2949
add_filter( 'map_meta_cap', array( $this, 'grant_edit_post_capability_for_changeset' ), 10, 4 );
wp-includes/capabilities.php 2956
remove_filter( 'map_meta_cap', array( $this, 'grant_edit_post_capability_for_changeset' ), 10 );