Skip to content

Commit 6eea893

Browse files
Abilities API: document the show_in_abilities registration-timing contract
The core/settings ability snapshots the exposed settings when it registers on wp_abilities_api_init, so a setting must be registered before that hook fires to be exposed. Note this on the show_in_abilities register_setting() argument so integrators know their register_setting() has to run earlier.
1 parent 2746171 commit 6eea893

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/wp-includes/option.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3021,7 +3021,10 @@ function register_initial_settings() {
30213021
* @type bool|array $show_in_abilities Whether this setting should be exposed through the Abilities API
30223022
* (e.g. the `core/settings` ability). When registering complex settings,
30233023
* this argument may optionally be an array with optional 'name' and
3024-
* 'schema' keys, mirroring the `show_in_rest` shape.
3024+
* 'schema' keys, mirroring the `show_in_rest` shape. The set of exposed
3025+
* settings is captured when the `core/settings` ability registers on the
3026+
* `wp_abilities_api_init` hook, so a setting must be registered before
3027+
* that hook fires to be exposed.
30253028
* @type mixed $default Default value when calling `get_option()`.
30263029
* }
30273030
*/

0 commit comments

Comments
 (0)