auth_(object_type)_(object_subtype)_meta_(meta_key)
Deprecated from version 4.9.8. It is no longer supported and can be removed in future releases. See auth_(object_type)_meta_(meta_key)_for_(object_subtype).
Filters whether the user is allowed to edit meta for specific object types/subtypes.
Return true to have the mapped meta caps from edit_{$object_type} apply.
The dynamic portion of the hook name, $object_type refers to the object type being filtered. The dynamic portion of the hook name, $object_subtype refers to the object subtype being filtered. The dynamic portion of the hook name, $meta_key, refers to the meta key passed to map_meta_cap().
Usage
add_filter( 'auth_(object_type)_(object_subtype)_meta_(meta_key)', 'wp_kama_auth_object_type_subtype_meta_key_filter', 10, 3 ); /** * Function for `auth_(object_type)_(object_subtype)_meta_(meta_key)` filter-hook. * * @param bool $allowed Whether the user can add the object meta. * @param string $meta_key The meta key. * @param int $object_id Object ID. * * @return bool */ function wp_kama_auth_object_type_subtype_meta_key_filter( $allowed, $meta_key, $object_id ){ // filter... return $allowed; }
- $allowed(true|false)
- Whether the user can add the object meta.
Default: false - $meta_key(string)
- The meta key.
- $object_id(int)
- Object ID.
Changelog
Since 4.6.0 | Introduced. |
Since 4.6.0 | As auth_post_{$post_type}_meta_{$meta_key}. |
Since 4.7.0 | Renamed from auth_post_{$post_type}_meta_{$meta_key} to auth_{$object_type}_{$object_subtype}_meta_{$meta_key}. |
Deprecated since 4.9.8 | Use {@see 'auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}'} instead. |
Where the hook is called
auth_(object_type)_(object_subtype)_meta_(meta_key)
wp-includes/capabilities.php 535-540
$allowed = apply_filters_deprecated( "auth_{$object_type}_{$object_subtype}_meta_{$meta_key}", array( $allowed, $meta_key, $object_id, $user_id, $cap, $caps ), '4.9.8', "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}" );
Where the hook is used in WordPress
wp-includes/meta.php 1499
add_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['auth_callback'], 10, 6 );
wp-includes/meta.php 1501
add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 );
wp-includes/meta.php 1644
remove_filter( "auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}", $args['auth_callback'] );
wp-includes/meta.php 1646
remove_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'] );