Commit 29b604339f for wordpress.org
commit 29b604339fcb9c8fba976c165fc9605db476d798
Author: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
Date: Wed Dec 2 16:11:07 2026 +0000
Abilities API: Add the `core/settings-update` ability.
Add a `core/settings-update` ability that updates the settings registered with `show_in_abilities`, named as in `core/settings-get`, and returns their saved values. A `null` value resets a setting to its default. Values are validated before anything is saved, and the ability requires the `manage_options` capability.
Developed in https://github.com/WordPress/wordpress-develop/pull/10892.
Props jorgefilipecosta, gziolo, westonruter, justlevine.
See #64616.
Built from https://develop.svn.wordpress.org/trunk@65861
git-svn-id: http://core.svn.wordpress.org/trunk@64890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/abilities.php b/wp-includes/abilities.php
index 835c19e04f..245ccbd094 100644
--- a/wp-includes/abilities.php
+++ b/wp-includes/abilities.php
@@ -50,6 +50,7 @@ function wp_register_core_ability_categories(): void {
*
* @since 6.9.0
* @since 7.2.0 Added the `core/content-query`, `core/settings-get`, and `core/users-query` abilities.
+ * @since 7.3.0 Added the `core/settings-update` ability.
*
* @global wpdb $wpdb WordPress database abstraction object.
*/
@@ -371,7 +372,7 @@ function wp_register_core_abilities(): void {
)
);
- // Register the settings abilities (currently the read-only `core/settings-get`).
+ // Register the settings abilities (`core/settings-get` and `core/settings-update`).
( new WP_Abilities_Settings() )->register();
// Register the user abilities (currently the read-only `core/users-query`).
diff --git a/wp-includes/abilities/class-wp-abilities-settings.php b/wp-includes/abilities/class-wp-abilities-settings.php
index 5729103846..c0f3df7ce5 100644
--- a/wp-includes/abilities/class-wp-abilities-settings.php
+++ b/wp-includes/abilities/class-wp-abilities-settings.php
@@ -12,15 +12,14 @@ declare( strict_types = 1 );
/**
* Core class used to register settings-related abilities.
*
- * Provides the read-only `core/settings-get` ability and the shared building blocks
- * (exposed-settings discovery and schema generation) that are intended to also back a
- * future write-oriented `core/settings-update` ability.
+ * Provides the `core/settings-get` and `core/settings-update` abilities and the building
+ * blocks they share (exposed-settings discovery, schema generation and reading the values).
*
* Unlike the core abilities registered directly in wp_register_core_abilities() as
* self-contained closures, the settings abilities live in a dedicated class
* because they share state: the set of exposed settings is computed once at registration
- * and reused by the input schema, the output schema, and the execute callback, and the
- * same helpers are meant to be shared with the future write ability.
+ * and reused by the input schemas, the output schemas, and the execute callbacks of both
+ * abilities.
*
* The exposed settings are captured when the ability registers, the first time the abilities
* registry is used in a request. Settings registered later in that request are not exposed.
@@ -32,8 +31,11 @@ declare( strict_types = 1 );
* checks permissions before running them.
*
* @since 7.2.0
+ * @since 7.3.0 Added the `core/settings-update` ability.
*
* @access private
+ *
+ * @phpstan-type Exposed_Setting array{option: string, group: string, default: mixed, schema: array<string, mixed>}
*/
final class WP_Abilities_Settings {
@@ -45,14 +47,55 @@ final class WP_Abilities_Settings {
*/
private const CATEGORY = 'site';
+ /**
+ * Options that `core/settings-update` cannot write, whatever name exposes them.
+ *
+ * The WordPress address, the site address and the administration email address are left to
+ * Settings > General, which confirms a new administration email address before it is used.
+ *
+ * @since 7.3.0
+ * @var string[]
+ */
+ private const READ_ONLY_OPTIONS = array( 'siteurl', 'home', 'admin_email' );
+
+ /**
+ * Options that `core/settings-update` cannot reset with a null value, whatever name exposes them.
+ *
+ * They have no registered default, so a reset would delete them, and Core needs a value:
+ * without one, dates and times show as empty strings, new posts get no category and an
+ * empty comment and ping status, and the posts home page is not the front page. They can
+ * still be updated with a value.
+ *
+ * @since 7.3.0
+ * @var string[]
+ */
+ private const NON_RESETTABLE_OPTIONS = array(
+ 'date_format',
+ 'time_format',
+ 'default_category',
+ 'show_on_front',
+ 'default_comment_status',
+ 'default_ping_status',
+ );
+
/**
* Settings exposed through the Abilities API, computed once at registration.
*
* @since 7.2.0
- * @var array<string, array{option: string, group: string, default: mixed, schema: array<string, mixed>}>
+ * @var array<string, array<string, mixed>>
+ * @phpstan-var array<string, Exposed_Setting>
*/
private $exposed_settings = array();
+ /**
+ * Exposed settings that `core/settings-update` can write, computed once at registration.
+ *
+ * @since 7.3.0
+ * @var array<string, array<string, mixed>>
+ * @phpstan-var array<string, Exposed_Setting>
+ */
+ private $writable_settings = array();
+
/**
* Registers all settings abilities.
*
@@ -60,6 +103,7 @@ final class WP_Abilities_Settings {
* exposed to abilities.
*
* @since 7.2.0
+ * @since 7.3.0 Registers the `core/settings-update` ability.
*/
public function register(): void {
$this->exposed_settings = $this->get_exposed_settings();
@@ -67,7 +111,21 @@ final class WP_Abilities_Settings {
return;
}
+ /*
+ * Intentional: every exposed setting can be updated, including the settings exposed
+ * before `core/settings-update` existed, except the options in READ_ONLY_OPTIONS and the
+ * settings whose schema sets `readonly` to true. Naming one of those is refused like any
+ * unknown name. Only `readonly` at the top level of the schema counts: a read-only
+ * property inside an object setting is written with the rest of the object.
+ */
+ $this->writable_settings = array_filter(
+ $this->exposed_settings,
+ static fn( array $setting ): bool => empty( $setting['schema']['readonly'] )
+ && ! in_array( strtolower( $setting['option'] ), self::READ_ONLY_OPTIONS, true )
+ );
+
$this->register_settings_get();
+ $this->register_settings_update();
}
/**
@@ -85,7 +143,7 @@ final class WP_Abilities_Settings {
'description' => __( 'Returns WordPress settings as a flat map of setting name to value. By default returns all settings exposed to abilities, or optionally a subset filtered by settings group, by setting name, or both. A setting whose value does not match its schema is left out. Requires an authenticated user who can manage options.' ),
'category' => self::CATEGORY,
'input_schema' => $this->get_settings_get_input_schema( $groups, array_map( 'strval', array_keys( $this->exposed_settings ) ) ),
- 'output_schema' => $this->get_settings_get_output_schema(),
+ 'output_schema' => $this->get_settings_output_schema( $this->exposed_settings, __( 'A map of setting name to its current value.' ) ),
'execute_callback' => function ( $input = array() ): array {
return $this->execute_settings_get( $input );
},
@@ -102,6 +160,50 @@ final class WP_Abilities_Settings {
);
}
+ /**
+ * Registers the `core/settings-update` ability.
+ *
+ * Registers nothing when no exposed setting is writable.
+ *
+ * The ability is marked destructive because a null value deletes the stored value of a
+ * setting without a default, see execute_settings_update(). It is not marked idempotent,
+ * although repeating a call has no further effect: an ability that is both destructive and
+ * idempotent runs with the DELETE method, and this ability updates settings.
+ *
+ * @since 7.3.0
+ */
+ private function register_settings_update(): void {
+ if ( empty( $this->writable_settings ) ) {
+ return;
+ }
+
+ wp_register_ability(
+ 'core/settings-update',
+ array(
+ 'label' => __( 'Update Settings' ),
+ 'description' => __( 'Updates WordPress settings and returns the saved values of the settings named in the call. A null value resets a setting to its default, or deletes its stored value when it has no default. A setting whose schema does not accept null cannot be reset. Read-only settings, such as the WordPress address and the administration email address, cannot be updated. Requires an authenticated user who can manage options, and who can also manage privacy options to set the privacy policy page.' ),
+ 'category' => self::CATEGORY,
+ 'input_schema' => $this->get_settings_update_input_schema(),
+ 'output_schema' => $this->get_settings_output_schema( $this->writable_settings, __( 'A map of setting name to its value after the update.' ) ),
+ 'execute_callback' => function ( $input ) {
+ return $this->execute_settings_update( $input );
+ },
+ 'permission_callback' => function ( $input = array() ): bool {
+ return $this->check_settings_update_permission( $input );
+ },
+ 'required_capabilities' => array( 'manage_options' ),
+ 'meta' => array(
+ 'annotations' => array(
+ 'readonly' => false,
+ 'destructive' => true,
+ 'idempotent' => false,
+ ),
+ 'public' => true,
+ ),
+ )
+ );
+ }
+
/**
* Executes the `core/settings-get` ability.
*
@@ -115,7 +217,7 @@ final class WP_Abilities_Settings {
$group = isset( $input['group'] ) && is_string( $input['group'] ) ? $input['group'] : '';
$fields = rest_sanitize_array( $input['fields'] ?? array() );
- $result = array();
+ $requested = array();
foreach ( $this->exposed_settings as $exposed_name => $setting ) {
if ( '' !== $group && $setting['group'] !== $group ) {
continue;
@@ -124,6 +226,264 @@ final class WP_Abilities_Settings {
continue;
}
+ $requested[ $exposed_name ] = $setting;
+ }
+
+ return $this->get_setting_values( $requested );
+ }
+
+ /**
+ * Checks the permission of the current user to update the settings named in a
+ * `core/settings-update` call.
+ *
+ * The `manage_options` capability is checked before, as a required capability of the ability.
+ * Setting or resetting the privacy policy page also requires the `manage_privacy_options`
+ * capability.
+ *
+ * Intentionally strict: the whole call is refused, instead of leaving this one setting out
+ * of the update. The rule belongs to the option, whatever name exposes it.
+ *
+ * @since 7.3.0
+ *
+ * @param mixed $input Optional. The ability input, which a direct call to
+ * WP_Ability::check_permissions() may pass unprepared. Default empty array.
+ * @return bool Whether the current user can update the named settings.
+ */
+ private function check_settings_update_permission( $input = array() ): bool {
+ $input = rest_sanitize_object( $input );
+ $named = array_intersect_key( $this->writable_settings, rest_sanitize_object( $input['data'] ?? array() ) );
+
+ return ! in_array( 'wp_page_for_privacy_policy', array_map( 'strtolower', array_column( $named, 'option' ) ), true )
+ || current_user_can( 'manage_privacy_options' );
+ }
+
+ /**
+ * Executes the `core/settings-update` ability.
+ *
+ * The checks of the ability run before the first write, so a call they refuse changes nothing.
+ * A callback that runs while a value is saved, such as the sanitize callback of a setting, can
+ * still stop the call after the settings before it are saved. The output holds only the
+ * settings named in the call, read the same way as for `core/settings-get`.
+ *
+ * @since 7.3.0
+ *
+ * @param mixed $input The ability input, as prepared by WP_Ability::execute().
+ * @return array<string, mixed>|WP_Error Map of the named setting names to their values after the update,
+ * or an error when the update is refused.
+ */
+ private function execute_settings_update( $input ) {
+ $input = rest_sanitize_object( $input );
+ $data = rest_sanitize_object( $input['data'] ?? array() );
+ $named = array_intersect_key( $this->writable_settings, $data );
+
+ /*
+ * Intentionally strict: every value is checked before the first write, so a call refused
+ * here changes nothing. A value is refused when the setting cannot use it, instead of being
+ * saved as sent or silently replaced with the stored value. A null value is refused while
+ * the setting has a stored value that `core/settings-get` leaves out, because the value does
+ * not match the setting's schema: the caller cannot see what would be replaced or deleted.
+ * Unusable values are reported first.
+ *
+ * Intentional: a null value stores the default of a setting that has one, and deletes the
+ * stored value of a setting without one. A registered default only applies in requests that
+ * register the setting, and Core registers its own settings only in REST and abilities
+ * requests, so other requests would read a deleted value as false. A setting without a
+ * default then has no value, and is left out of the output and of `core/settings-get`,
+ * until a value is written again.
+ */
+ $values = array();
+ $invalid_params = array();
+ $invalid_stored = array();
+ foreach ( $named as $exposed_name => $setting ) {
+ $value = $data[ $exposed_name ] ?? $setting['default'];
+
+ /*
+ * English is stored as an empty string. `en_US` is what the language reads as when
+ * none is stored, and sanitize_option() would replace it with the stored value.
+ */
+ if ( 'wplang' === strtolower( $setting['option'] ) && 'en_US' === $value ) {
+ $value = '';
+ }
+
+ if ( null !== $data[ $exposed_name ] ) {
+ $message = $this->get_invalid_value_message( $setting['option'], $value, "data[{$exposed_name}]" );
+ if ( null !== $message ) {
+ $invalid_params[ "data[{$exposed_name}]" ] = $message;
+ }
+ } elseif (
+ // The stored value reads as null when there is none, and then there is nothing to replace.
+ null !== get_option( $setting['option'], null )
+ && array() === $this->get_setting_values( array( $exposed_name => $setting ) )
+ ) {
+ $invalid_stored[ "data[{$exposed_name}]" ] = sprintf(
+ /* translators: %s: Property name. */
+ __( 'The %s property has an invalid stored value, and cannot be updated to null.' ),
+ $exposed_name
+ );
+ }
+
+ $values[ $exposed_name ] = $value;
+ }
+
+ if ( ! empty( $invalid_params ) ) {
+ return $this->get_refused_settings_error(
+ 'settings_invalid_value',
+ $invalid_params,
+ 400,
+ /* translators: %s: List of invalid parameters. */
+ __( 'Invalid parameter(s): %s' )
+ );
+ }
+
+ if ( ! empty( $invalid_stored ) ) {
+ return $this->get_refused_settings_error(
+ 'settings_invalid_stored_value',
+ $invalid_stored,
+ 500,
+ /* translators: %s: List of parameters. */
+ __( 'These parameters have an invalid stored value, and cannot be updated to null: %s' )
+ );
+ }
+
+ foreach ( $values as $exposed_name => $value ) {
+ $option = $named[ $exposed_name ]['option'];
+ if ( null === $value ) {
+ delete_option( $option );
+ continue;
+ }
+
+ update_option( $option, $value );
+
+ /*
+ * update_option() stores nothing when no value is stored and the sanitized value matches
+ * the default get_option() reads, so store that default. The stored value reads as null
+ * when there is none, while a stored false reads as false.
+ */
+ if ( null === get_option( $option, null ) ) {
+ add_option( $option, get_option( $option ) );
+ }
+ }
+
+ return $this->get_setting_values( $named );
+ }
+
+ /**
+ * Builds the error for the settings a `core/settings-update` call refuses.
+ *
+ * The message is the message of the refused setting, or names every refused setting when
+ * there are several. The error data maps the input path of each refused setting to its
+ * message, so callers can tell which settings failed.
+ *
+ * @since 7.3.0
+ *
+ * @param string $code The error code.
+ * @param array<string, string> $params Messages keyed by the input path of each refused setting.
+ * @param int $status The HTTP status code.
+ * @param string $multiple_message The message when several settings are refused, with
+ * a placeholder for the list of their input paths.
+ * @return WP_Error The error.
+ */
+ private function get_refused_settings_error( string $code, array $params, int $status, string $multiple_message ): WP_Error {
+ if ( 1 === count( $params ) ) {
+ $message = reset( $params );
+ } else {
+ $message = sprintf( $multiple_message, implode( ', ', array_keys( $params ) ) );
+ }
+
+ return new WP_Error(
+ $code,
+ $message,
+ array(
+ 'status' => $status,
+ 'params' => $params,
+ )
+ );
+ }
+
+ /**
+ * Checks a value that matches its schema against what the option can use.
+ *
+ * The rules belong to the option, whatever name exposes it.
+ *
+ * @since 7.3.0
+ *
+ * @param string $option The option name.
+ * @param mixed $value The value to save, which is not null.
+ * @param string $param The input path of the setting, used in the message.
+ * @return string|null The error message when the option cannot use the value, null otherwise.
+ */
+ private function get_invalid_value_message( string $option, $value, string $param ): ?string {
+ switch ( strtolower( $option ) ) {
+ case 'timezone_string':
+ if ( '' !== $value && ! in_array( $value, timezone_identifiers_list( DateTimeZone::ALL_WITH_BC ), true ) ) {
+ return __( 'The timezone you have entered is not valid. Please select a valid timezone.' );
+ }
+ break;
+
+ case 'wplang':
+ $languages = get_available_languages();
+ if ( '' !== $value && ! in_array( $value, $languages, true ) ) {
+ /* translators: 1: Parameter, 2: List of valid values. */
+ return wp_sprintf( __( '%1$s is not one of %2$l.' ), $param, array_merge( array( 'en_US' ), $languages ) );
+ }
+ break;
+
+ case 'default_post_format':
+ // An empty value is the standard format, as `0` is.
+ if ( '0' !== $value && '' !== $value && ! in_array( $value, get_post_format_slugs(), true ) ) {
+ return __( 'Invalid post format.' );
+ }
+ break;
+
+ case 'page_on_front':
+ case 'page_for_posts':
+ case 'wp_page_for_privacy_policy':
+ /*
+ * The Settings screens never offer a page that is in the trash or an auto-draft.
+ *
+ * Known gap: a page in any other status is accepted, such as a draft, pending, private
+ * or scheduled page, which logged-out visitors cannot see. Settings > Reading offers only
+ * published pages for the front page and the page for posts, but only in its form: the
+ * Settings API has no rule for the status of these pages yet.
+ */
+ if (
+ 0 !== $value
+ && (
+ ! is_int( $value )
+ || 'page' !== get_post_type( $value )
+ || in_array( get_post_status( $value ), array( 'trash', 'auto-draft' ), true )
+ )
+ ) {
+ return __( 'Invalid post ID.' );
+ }
+ break;
+
+ case 'default_category':
+ // A negative ID would be looked up as its absolute value.
+ if ( ! is_int( $value ) || $value <= 0 || ! term_exists( $value, 'category' ) ) {
+ return __( 'Invalid term ID.' );
+ }
+ break;
+ }
+
+ return null;
+ }
+
+ /**
+ * Reads the current values of the given exposed settings.
+ *
+ * A setting without a value, or whose value does not match its schema, is left out.
+ *
+ * @since 7.3.0
+ *
+ * @param array<string, array<string, mixed>> $settings Exposed settings, keyed by exposed name.
+ * @return array<string, mixed> Map of exposed setting name to current value.
+ *
+ * @phpstan-param array<string, Exposed_Setting> $settings
+ */
+ private function get_setting_values( array $settings ): array {
+ $result = array();
+ foreach ( $settings as $exposed_name => $setting ) {
/*
* As the settings endpoint does, read a setting that was never saved as its registered
* default, or leave it out when it has none: get_option() would return false, which a
@@ -196,20 +556,120 @@ final class WP_Abilities_Settings {
}
/**
- * Builds the output schema for the `core/settings-get` ability.
+ * Builds the input schema for the `core/settings-update` ability.
+ *
+ * Each writable setting accepts a value of its own schema, or null.
+ *
+ * @since 7.3.0
+ *
+ * @return array<string, mixed> The input JSON Schema.
+ */
+ private function get_settings_update_input_schema(): array {
+ return array(
+ 'type' => 'object',
+ 'properties' => array(
+ 'data' => array(
+ 'type' => 'object',
+ 'description' => __( 'Settings to update, keyed by setting name. A null value resets a setting to its default, or deletes its stored value when it has no default. A setting whose schema does not accept null cannot be reset.' ),
+ 'properties' => array_map( array( $this, 'get_update_value_schema' ), $this->writable_settings ),
+ 'additionalProperties' => false,
+ 'minProperties' => 1,
+ ),
+ ),
+ 'required' => array( 'data' ),
+ 'additionalProperties' => false,
+ );
+ }
+
+ /**
+ * Returns the input schema of a writable setting.
+ *
+ * @since 7.3.0
+ *
+ * @param array<string, mixed> $setting The writable setting.
+ * @return array<string, mixed> The input JSON Schema of the setting.
+ *
+ * @phpstan-param array{
+ * option: string,
+ * schema: array{
+ * type: non-empty-string|non-empty-string[],
+ * enum?: mixed[],
+ * default?: mixed,
+ * ...
+ * },
+ * ...
+ * } $setting
+ */
+ private function get_update_value_schema( array $setting ): array {
+ $schema = $setting['schema'];
+
+ // The default is for reading a setting: a client that fills in defaults would write it on every call.
+ unset( $schema['default'] );
+
+ return in_array( strtolower( $setting['option'] ), self::NON_RESETTABLE_OPTIONS, true ) ? $schema : $this->get_nullable_schema( $schema );
+ }
+
+ /**
+ * Allows null in a setting's value schema.
+ *
+ * @since 7.3.0
+ *
+ * @param array<string, mixed> $schema The value JSON Schema, without a default.
+ * @return array<string, mixed> The value JSON Schema that also accepts null.
+ *
+ * @phpstan-param array{
+ * type: non-empty-string|non-empty-string[],
+ * enum?: mixed[],
+ * ...
+ * } $schema
+ * @phpstan-return array{
+ * type: non-empty-string[],
+ * enum?: mixed[],
+ * ...
+ * }|array{
+ * anyOf: array{ array<string, mixed>, array{ type: 'null' } },
+ * }
+ */
+ private function get_nullable_schema( array $schema ): array {
+ // A null type would still be refused by the subschemas, so the schema is listed next to a null schema.
+ if ( isset( $schema['anyOf'] ) || isset( $schema['oneOf'] ) ) {
+ return array(
+ 'anyOf' => array(
+ $schema,
+ array( 'type' => 'null' ),
+ ),
+ );
+ }
+
+ $schema['type'] = array_merge( (array) $schema['type'], array( 'null' ) );
+ if ( isset( $schema['enum'] ) ) {
+ $schema['enum'][] = null;
+ }
+
+ return $schema;
+ }
+
+ /**
+ * Builds the output schema of a settings ability, from the settings it can return.
*
- * No setting is marked required because the `group` and `fields` inputs let the caller
- * request any subset, and a setting whose value does not match its schema is left out.
+ * No setting is marked required because both abilities return a subset: `core/settings-get`
+ * the settings its `group` and `fields` inputs ask for, and `core/settings-update` the settings
+ * named in the call. A setting without a value, or whose value does not match its schema, is
+ * also left out.
*
* @since 7.2.0
*
+ * @param array<string, array<string, mixed>> $settings Exposed settings the ability can return, keyed by exposed name.
+ * @param string $description The description of the output.
* @return array<string, mixed> The output JSON Schema.
+ *
+ * @phpstan-param array<string, Exposed_Setting> $settings
*/
- private function get_settings_get_output_schema(): array {
+ private function get_settings_output_schema( array $settings, string $description ): array {
return array(
'type' => 'object',
- 'description' => __( 'A map of setting name to its current value.' ),
- 'properties' => wp_list_pluck( $this->exposed_settings, 'schema' ),
+ 'description' => $description,
+ 'properties' => wp_list_pluck( $settings, 'schema' ),
'additionalProperties' => false,
);
}
@@ -227,7 +687,9 @@ final class WP_Abilities_Settings {
*
* @since 7.2.0
*
- * @return array<string, array{option: string, group: string, default: mixed, schema: array<string, mixed>}> Settings keyed by exposed name.
+ * @return array<string, array<string, mixed>> Settings keyed by exposed name.
+ *
+ * @phpstan-return array<string, Exposed_Setting>
*/
private function get_exposed_settings(): array {
$settings = array();
@@ -239,7 +701,7 @@ final class WP_Abilities_Settings {
$show = $this->get_exposure_args( $args );
- $schema = $this->value_schema( $args, $show );
+ $schema = $this->get_value_schema( $args, $show );
if ( ! in_array( $schema['type'], array( 'number', 'integer', 'string', 'boolean', 'array', 'object' ), true ) ) {
continue;
}
@@ -266,7 +728,11 @@ final class WP_Abilities_Settings {
* overrides the registered default.
*/
$settings[ $exposed_name ] = array(
- 'option' => $option_name,
+ /*
+ * The options API trims the name and the database ignores its case, so the rules
+ * that name an option compare the trimmed name in lower case.
+ */
+ 'option' => trim( $option_name ),
'group' => $args['group'] ?? '',
'default' => array_key_exists( 'default', $schema ) ? $schema['default'] : ( $args['default'] ?? null ),
'schema' => $schema,
@@ -308,7 +774,7 @@ final class WP_Abilities_Settings {
* @param array<string, mixed> $show The exposure arguments, see get_exposure_args().
* @return array<string, mixed> The value JSON Schema.
*/
- private function value_schema( array $args, $show ): array {
+ private function get_value_schema( array $args, $show ): array {
$schema = array(
'type' => $args['type'],
);
diff --git a/wp-includes/option.php b/wp-includes/option.php
index bf463d9847..71c97b5342 100644
--- a/wp-includes/option.php
+++ b/wp-includes/option.php
@@ -3048,6 +3048,8 @@ function _wp_register_initial_settings_for_abilities(): void {
* Please consider writing more inclusive code.
* @since 6.6.0 Added the `label` argument.
* @since 7.2.0 Added the `show_in_abilities` argument.
+ * @since 7.3.0 Settings exposed with the `show_in_abilities` argument can be updated through the Abilities API,
+ * unless their schema sets 'readonly' to true.
*
* @global array $new_allowed_options
* @global array $wp_registered_settings
@@ -3070,10 +3072,18 @@ function _wp_register_initial_settings_for_abilities(): void {
* @type bool|array $show_in_rest Whether data associated with this setting should be included in the
* REST API. When registering complex settings, this argument may
* optionally be an array with a 'schema' key.
- * @type bool|array $show_in_abilities Whether this setting should be exposed through the Abilities API.
+ * @type bool|array $show_in_abilities Whether this setting should be exposed through the Abilities API,
+ * where users who can manage options can read and update it.
+ * The WordPress address, the site address and the administration
+ * email address cannot be updated. The date format, the time format,
+ * the default category, what to show on the front page, and the
+ * default comment and ping statuses cannot be reset with a null value.
* When true, it uses the same name and schema as `$show_in_rest`.
* It may also be an array with 'name' and 'schema' keys, used instead of
* `$show_in_rest` rather than merged with it.
+ * A setting whose schema sets 'readonly' to true can be read but
+ * not updated. Only 'readonly' at the top level of the schema
+ * counts, not inside the properties of an object setting.
* Settings registered after abilities initialize are not exposed.
* @type mixed $default Default value when calling `get_option()`.
* }
diff --git a/wp-includes/version.php b/wp-includes/version.php
index e753249c94..54165cac54 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.3-alpha-65860';
+$wp_version = '7.3-alpha-65861';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.