Skip to content

Abilities API: Mark the read-only settings with show_in_abilities - #16383

Draft
jorgefilipecosta wants to merge 3 commits into
WordPress:trunkfrom
jorgefilipecosta:update/settings-readonly-marker
Draft

jorgefilipecosta wants to merge 3 commits into
WordPress:trunkfrom
jorgefilipecosta:update/settings-readonly-marker

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Stacked on #16288, only the last two commits belong to this PR.

Follow-up to #10892.

This PR makes the show_in_abilities readonly marker the only way to mark a setting as read only for core/settings-update:

  • url and email are marked as read only where they are registered, and core/settings-get returns them unchanged.
  • The private list of read-only options is removed. A plugin exposing home, or siteurl or admin_email under another name, needs to mark it as read only.
  • Shape change: a readonly flag in the setting schema no longer keeps the setting out of core/settings-update.

Trac ticket: https://core.trac.wordpress.org/ticket/66899

Testing

Verify unit tests are passing:

vendor/bin/phpunit --group abilities-api,option

AI disclosure: the change and tests were drafted with AI assistance (Claude Code).

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Post types accept `array( 'readonly' => true )` for `show_in_abilities`, which keeps them readable through abilities and marks them read only. Settings accept the same `readonly` key in their `show_in_abilities` array.

The new `wp_is_writable_through_abilities()` function tells write abilities whether a `show_in_abilities` value allows writes.

See #66844.
`core/settings-update` now writes only the settings whose `show_in_abilities` value allows writes, as `wp_is_writable_through_abilities()` tells. The WordPress address (`url`) and the administration email address (`email`) set `readonly` in their `show_in_abilities` array, with the same name and schema as before.

This replaces the `READ_ONLY_OPTIONS` list of `WP_Abilities_Settings` and the `readonly` keyword in a setting's schema, so a single marker decides which settings are read only.

See #64616, #66844.
@jorgefilipecosta
jorgefilipecosta force-pushed the update/settings-readonly-marker branch from 3bee4fd to 6ab9d83 Compare December 2, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant