Make WordPress Core


Ignore:
Timestamp:
07/14/2026 03:23:34 PM (7 weeks ago)
Author:
gziolo
Message:

Use the public meta flag for core abilities.

Adopt the high-level public flag introduced in [62729] for the core abilities that ship with WordPress. The core/get-site-info, core/get-user-info, and core/get-environment-info abilities now declare meta.public instead of meta.show_in_rest.

The public flag seeds show_in_rest through the resolution chain, so REST exposure stays exactly the same. Storing the intent as public also lets other channels such as MCP and AI agents read it through the wp_register_ability_args filter. An explicit show_in_rest still wins when a channel needs to opt out.

Also make the public flag default to false so it is always present in the resolved meta, treat a null value as unset, and reword the related documentation across the ability class, the registry, the REST schema, and wp_register_ability().

Follow-up to [62729].
Props gziolo, mukesh27, khokansardar.
Fixes #65568.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/abilities.php

    r62426 r62737  
    133133                        },
    134134                        'meta'                => array(
    135                                 'annotations'  => array(
     135                                'annotations' => array(
    136136                                        'readonly'    => true,
    137137                                        'destructive' => false,
    138138                                        'idempotent'  => true,
    139139                                ),
    140                                 'show_in_rest' => true,
     140                                'public'      => true,
    141141                        ),
    142142                )
     
    257257                        },
    258258                        'meta'                => array(
    259                                 'annotations'  => array(
     259                                'annotations' => array(
    260260                                        'readonly'    => true,
    261261                                        'destructive' => false,
    262262                                        'idempotent'  => true,
    263263                                ),
    264                                 'show_in_rest' => true,
     264                                'public'      => true,
    265265                        ),
    266266                )
     
    343343                        },
    344344                        'meta'                => array(
    345                                 'annotations'  => array(
     345                                'annotations' => array(
    346346                                        'readonly'    => true,
    347347                                        'destructive' => false,
    348348                                        'idempotent'  => true,
    349349                                ),
    350                                 'show_in_rest' => true,
     350                                'public'      => true,
    351351                        ),
    352352                )
Note: See TracChangeset for help on using the changeset viewer.