Skip to content

Settings: Make screen options filterable #1802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 16, 2025
Merged

Conversation

obenland
Copy link
Member

Making the screen options list filterable makes it possible to adjust it on WP.com, a step towards enabling the admin UI there.

Proposed changes:

  • Makes list of screen options filterable.
  • Updates data handling and html display based on a list of screen options.

Testing instructions:

  • Go to Settings > Activitypub.
  • Find the screen options tab in the top right and open it.
  • Experiment with different on/off settings and make sure they still work and save correctly.

Changelog entry

  • Automatically create a changelog entry from the details below.
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Added - for new features
  • Changed - for changes in existing functionality
  • Deprecated - for soon-to-be removed features
  • Removed - for now removed features
  • Fixed - for any bug fixes
  • Security - in case of vulnerabilities

Message

Screen options in the Activitypub settings page are now filterable.

@obenland obenland requested review from pfefferle and Copilot June 11, 2025 21:05
@obenland obenland self-assigned this Jun 11, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds the ability to filter which screen options appear on the ActivityPub settings page and refactors the existing static checkbox logic into a loop over a filterable array.

  • Introduces a activitypub_screen_options filter for customizing available screen options.
  • Replaces hard-coded POST handling with a loop that saves any filtered options.
  • Converts the HTML output to a buffer and generates inputs dynamically.
Comments suppressed due to low confidence (2)

includes/wp-admin/class-settings.php:552

  • The docblock for the activitypub_screen_options filter is missing a @return annotation. Please add @return string[] to describe the expected format of the filtered array.
$screen_options = \apply_filters( 'activitypub_screen_options', $screen_options );

includes/wp-admin/class-settings.php:557

  • [nitpick] There are no tests covering the new filterable screen options. Consider adding unit or integration tests that hook into activitypub_screen_options to verify custom options are rendered and saved correctly.
foreach ( $screen_options as $option => $label ) {

@obenland obenland merged commit cfb33ca into trunk Jun 16, 2025
11 checks passed
@obenland obenland deleted the update/screen-options branch June 16, 2025 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants