@@ -470,7 +470,7 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
470470 if ( $ meta_key ) {
471471 $ allowed = ! is_protected_meta ( $ meta_key , $ object_type );
472472
473- if ( ! empty ( $ object_subtype ) && has_filter ( "auth_ {$ object_type }_meta_ {$ meta_key }_for_ {$ object_subtype }" ) ) {
473+ if ( has_filter ( "auth_ {$ object_type }_meta_ {$ meta_key }_for_ {$ object_subtype }" ) ) {
474474
475475 /**
476476 * Filters whether the user is allowed to edit a specific meta key of a specific object type and subtype.
@@ -512,36 +512,33 @@ function map_meta_cap( $cap, $user_id, ...$args ) {
512512 $ allowed = apply_filters ( "auth_ {$ object_type }_meta_ {$ meta_key }" , $ allowed , $ meta_key , $ object_id , $ user_id , $ cap , $ caps );
513513 }
514514
515- if ( ! empty ( $ object_subtype ) ) {
516-
517- /**
518- * Filters whether the user is allowed to edit meta for specific object types/subtypes.
519- *
520- * Return true to have the mapped meta caps from `edit_{$object_type}` apply.
521- *
522- * The dynamic portion of the hook name, `$object_type` refers to the object type being filtered.
523- * The dynamic portion of the hook name, `$object_subtype` refers to the object subtype being filtered.
524- * The dynamic portion of the hook name, `$meta_key`, refers to the meta key passed to map_meta_cap().
525- *
526- * @since 4.6.0 As `auth_post_{$post_type}_meta_{$meta_key}`.
527- * @since 4.7.0 Renamed from `auth_post_{$post_type}_meta_{$meta_key}` to
528- * `auth_{$object_type}_{$object_subtype}_meta_{$meta_key}`.
529- * @deprecated 4.9.8 Use {@see 'auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}'} instead.
530- *
531- * @param bool $allowed Whether the user can add the object meta. Default false.
532- * @param string $meta_key The meta key.
533- * @param int $object_id Object ID.
534- * @param int $user_id User ID.
535- * @param string $cap Capability name.
536- * @param string[] $caps Array of the user's capabilities.
537- */
538- $ allowed = apply_filters_deprecated (
539- "auth_ {$ object_type }_ {$ object_subtype }_meta_ {$ meta_key }" ,
540- array ( $ allowed , $ meta_key , $ object_id , $ user_id , $ cap , $ caps ),
541- '4.9.8 ' ,
542- "auth_ {$ object_type }_meta_ {$ meta_key }_for_ {$ object_subtype }"
543- );
544- }
515+ /**
516+ * Filters whether the user is allowed to edit meta for specific object types/subtypes.
517+ *
518+ * Return true to have the mapped meta caps from `edit_{$object_type}` apply.
519+ *
520+ * The dynamic portion of the hook name, `$object_type` refers to the object type being filtered.
521+ * The dynamic portion of the hook name, `$object_subtype` refers to the object subtype being filtered.
522+ * The dynamic portion of the hook name, `$meta_key`, refers to the meta key passed to map_meta_cap().
523+ *
524+ * @since 4.6.0 As `auth_post_{$post_type}_meta_{$meta_key}`.
525+ * @since 4.7.0 Renamed from `auth_post_{$post_type}_meta_{$meta_key}` to
526+ * `auth_{$object_type}_{$object_subtype}_meta_{$meta_key}`.
527+ * @deprecated 4.9.8 Use {@see 'auth_{$object_type}_meta_{$meta_key}_for_{$object_subtype}'} instead.
528+ *
529+ * @param bool $allowed Whether the user can add the object meta. Default false.
530+ * @param string $meta_key The meta key.
531+ * @param int $object_id Object ID.
532+ * @param int $user_id User ID.
533+ * @param string $cap Capability name.
534+ * @param string[] $caps Array of the user's capabilities.
535+ */
536+ $ allowed = apply_filters_deprecated (
537+ "auth_ {$ object_type }_ {$ object_subtype }_meta_ {$ meta_key }" ,
538+ array ( $ allowed , $ meta_key , $ object_id , $ user_id , $ cap , $ caps ),
539+ '4.9.8 ' ,
540+ "auth_ {$ object_type }_meta_ {$ meta_key }_for_ {$ object_subtype }"
541+ );
545542
546543 if ( ! $ allowed ) {
547544 $ caps [] = $ cap ;
0 commit comments