Skip to content

Disable client-side media processing in Playground#75950

Closed
adamsilverstein wants to merge 1 commit intotrunkfrom
fix-playground-incompatibility-with-csm
Closed

Disable client-side media processing in Playground#75950
adamsilverstein wants to merge 1 commit intotrunkfrom
fix-playground-incompatibility-with-csm

Conversation

@adamsilverstein
Copy link
Member

Summary

  • Adds a PHP_SAPI === 'wasm' check to gutenberg_is_client_side_media_processing_enabled() that returns false early in WordPress Playground environments
  • Prevents COOP/COEP cross-origin isolation headers from being sent, which conflict with Playground's iframe architecture and crash the editor
  • Media uploads fall back to server-side processing automatically in Playground

How it works

WordPress Playground runs PHP via WebAssembly (php-wasm), which registers its SAPI as "wasm". By checking PHP_SAPI before applying the filter, all CSM infrastructure is disabled: no window.__clientSideMediaProcessing = true flag, no COOP/COEP headers, and lib/media/load.php early-returns.

Closes #75941

Test plan

  • Verify CSM still works normally in standard WordPress environments
  • Verify Playground no longer crashes when editing posts with media
  • Run PHP unit tests: vendor/bin/phpunit phpunit/media/media-processing-test.php

🤖 Generated with Claude Code

WordPress Playground runs PHP via WebAssembly (php-wasm) inside
iframes. Client-side media processing requires cross-origin
isolation headers (COOP/COEP) that conflict with this iframe
architecture, causing the editor to crash. Check PHP_SAPI for
'wasm' and return false early to fall back to server-side
processing in Playground environments.
@adamsilverstein adamsilverstein force-pushed the fix-playground-incompatibility-with-csm branch from 99fb24b to f2118b6 Compare February 26, 2026 12:22
@bgrgicak
Copy link

@brandonpayton just merged a temporary fix that disables client-side media processing in Playground, so there's no need to disable it inside Gutenberg.

We plan to enable client-side media processing in Playground once we solve the root cause of the issue.

@adamsilverstein
Copy link
Member Author

@brandonpayton just merged a temporary fix that disables client-side media processing in Playground, so there's no need to disable it inside Gutenberg.

We plan to enable client-side media processing in Playground once we solve the root cause of the issue.

OK thanks for the update. I'll close this for now.

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.

Client Side Media does not work in Playground

2 participants