Skip to content

Add Settings > Media toggle to enable/disable client-side media - #7

Merged
adamsilverstein merged 3 commits into
mainfrom
copilot/add-ui-toggle-media-settings
Mar 3, 2026
Merged

adamsilverstein merged 3 commits into
mainfrom
copilot/add-ui-toggle-media-settings

Conversation

Copilot AI commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

No UI existed to control client-side media processing — required writing a PHP filter. This adds a checkbox to Settings > Media using the WordPress Settings API.

Changes

  • includes/settings.php (new): Registers csme_enabled option on the media settings page. Filters csme_use_coep_coop at priority 5 to disable COEP/COOP when unchecked.
  • client-side-media-experiments.php: Loads the new settings file.

Defaults to enabled, preserving existing behavior. Existing csme_use_coep_coop filter consumers at default priority still work as before.

Can also be controlled programmatically:

// Force disable regardless of UI setting
add_filter( 'csme_use_coep_coop', '__return_false' );

Settings > Media toggle

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/PHPCSStandards/PHPCSExtra/zipball/b598aa890815b8df16363271b659d73280129101
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Tktfsg /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e0UYPS /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/PHPCSStandards/PHPCSUtils/zipball/c216317e96c8b3f5932808f9b0f1f7a14e3bbf55
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Tktfsg /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e0UYPS /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0ca86845ce43291e8f5692c7356fccf3bcf02bf4
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Tktfsg /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e0UYPS /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/845eb62303d2ca9b289ef216356568ccc075ffd1
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Tktfsg /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e0UYPS /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Tktfsg /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e0UYPS /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/244d7b04fc4bc2117c15f5abe23eb933b5f02bbf
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Tktfsg /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e0UYPS /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/7c8d18b4d90dac9e86b0869a608fa09158e168fa
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Tktfsg /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e0UYPS /usr/bin/composer install --no-interaction --prefer-dist (http block)
  • https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7795ec6fa05663d716a549d0b44e47ffc8b0d4a6
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/Tktfsg /usr/bin/composer install (http block)
    • Triggering command: /usr/bin/php8.3 /usr/bin/php8.3 -n -c /tmp/e0UYPS /usr/bin/composer install --no-interaction --prefer-dist (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add UI toggle to enable or disable client-side media (Settings > Media)</issue_title>
<issue_description>Describe the feature
Add a user interface toggle under Settings > Media that allows administrators to turn client side media features on or off.

Use case
Currently, there isn't a simple way to disable or enable client side media processing. Providing a toggle in the settings page would give admins more granular control and enable easier testing or rollbacks where needed.

Additional context
This would improve the plugin's usability and administrative control. The toggle could be a simple switch in the UI, reflecting and syncing the internal option for client side media.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Summary by CodeRabbit

  • New Features
    • Added a new settings page under Settings > Media for managing Client-Side Media Experiments
    • Added a configuration toggle to enable or disable client-side media processing

Copilot AI and others added 2 commits March 2, 2026 04:16
Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com>
Co-authored-by: adamsilverstein <2676022+adamsilverstein@users.noreply.github.com>
Copilot AI changed the title [WIP] Add UI toggle to enable or disable client-side media Add Settings > Media toggle to enable/disable client-side media Mar 2, 2026
@adamsilverstein
adamsilverstein marked this pull request as ready for review March 2, 2026 07:05
@adamsilverstein

Copy link
Copy Markdown
Owner

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Mar 2, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b8c1fe and c9a5d31.

📒 Files selected for processing (2)
  • client-side-media-experiments.php
  • includes/settings.php

📝 Walkthrough

Walkthrough

This pull request adds a WordPress admin settings page integration to manage client-side media features. A new settings option csme_enabled is registered under Settings > Media with a checkbox toggle, sanitization callback, and a filter hook to conditionally disable COEP/COOP headers based on the administrator's preference.

Changes

Cohort / File(s) Summary
Plugin Bootstrap
client-side-media-experiments.php
Adds include statement for new settings.php file after plugin constant definitions.
Settings Page Implementation
includes/settings.php
New file introducing WordPress settings registration with csme_enabled option, UI components (checkbox field with label and description), sanitization callback, and filter hook to conditionally disable COEP/COOP headers.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A checkbox blooms in the Settings so bright,
To toggle client-side with a flick of delight!
Media experiments now under command,
Admins control with the turn of a hand! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a Settings > Media toggle to enable/disable client-side media processing.
Linked Issues check ✅ Passed The PR fully implements issue #5's requirements by adding a checkbox toggle on Settings > Media page to enable/disable client-side media processing with proper sanitization and conditional COEP/COOP filtering.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the Settings > Media toggle feature from issue #5; no unrelated modifications are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch copilot/add-ui-toggle-media-settings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

Add UI toggle to enable or disable client-side media (Settings > Media)

2 participants