diff --git src/wp-includes/capabilities.php src/wp-includes/capabilities.php
index 13851cc2e1..effba68db5 100644
|
|
function map_meta_cap( $cap, $user_id ) { |
308 | 308 | |
309 | 309 | $has_filter = has_filter( "auth_{$object_type}_meta_{$meta_key}" ) || has_filter( "auth_{$object_type}_{$sub_type}_meta_{$meta_key}" ); |
310 | 310 | if ( $meta_key && $has_filter ) { |
311 | | /** This filter is documented in wp-includes/meta.php */ |
| 311 | |
| 312 | /** |
| 313 | * Filters whether the user is allowed to edit meta. |
| 314 | * |
| 315 | * Use the {@see auth_post_$object_type_meta_$meta_key} filter to modify capabilities for |
| 316 | * specific object types. Return true to have the mapped meta caps from edit_{$object_type} apply. |
| 317 | * |
| 318 | * The dynamic portion of the hook name, `$object_type` refers to the object type being filtered. |
| 319 | * The dynamic portion of the hook name, `$meta_key`, refers to the meta key passed to map_meta_cap(). |
| 320 | * |
| 321 | * @since 3.3.0 As 'auth_post_meta_{$meta_key}'. |
| 322 | * @since 4.6.0 |
| 323 | * |
| 324 | * @param bool $allowed Whether the user can add the post meta. Default false. |
| 325 | * @param string $meta_key The meta key. |
| 326 | * @param int $post_id Post ID. |
| 327 | * @param int $user_id User ID. |
| 328 | * @param string $cap Capability name. |
| 329 | * @param array $caps User capabilities. |
| 330 | */ |
312 | 331 | $allowed = apply_filters( "auth_{$object_type}_meta_{$meta_key}", false, $meta_key, $object_id, $user_id, $cap, $caps ); |
313 | 332 | |
314 | | /** This filter is documented in wp-includes/meta.php */ |
| 333 | /** |
| 334 | * Filters whether the user is allowed to add post meta to a post of a given type. |
| 335 | * |
| 336 | * Use the {@see auth_$object_type_$sub_type_meta_$meta_key} filter to modify capabilities for |
| 337 | * specific object types/subtypes. Return true to have the mapped meta caps from edit_{$object_type} apply. |
| 338 | * |
| 339 | * The dynamic portion of the hook name, `$object_type` refers to the object type being filtered. |
| 340 | * The dynamic portion of the hook name, `$sub_type` refers to the object subtype being filtered. |
| 341 | * The dynamic portion of the hook name, `$meta_key`, refers to the meta key passed to map_meta_cap(). |
| 342 | * |
| 343 | * @since 4.6.0 As 'auth_post_{$post_type}_meta_{$meta_key}'. |
| 344 | * @since 4.7.0 |
| 345 | * |
| 346 | * @param bool $allowed Whether the user can add the post meta. Default false. |
| 347 | * @param string $meta_key The meta key. |
| 348 | * @param int $post_id Post ID. |
| 349 | * @param int $user_id User ID. |
| 350 | * @param string $cap Capability name. |
| 351 | * @param array $caps User capabilities. |
| 352 | */ |
315 | 353 | $allowed = apply_filters( "auth_{$object_type}_{$sub_type}_meta_{$meta_key}", $allowed, $meta_key, $object_id, $user_id, $cap, $caps ); |
316 | 354 | |
317 | 355 | if ( ! $allowed ) { |