Enables client-side media processing on Firefox and Safari via COEP/COOP cross-origin isolation headers.
In one sentence: this plugin gets client-side media processing working in Safari and Firefox, which WordPress otherwise only does in Chrome.
When you upload an image in Chrome, WordPress resizes and compresses it on your own device before it is sent, so less data goes over the wire and your server does much less work. In Safari and Firefox that is switched off, and uploads fall back to the older server-side path. This plugin switches it back on.
There is nothing to configure - activate the plugin and it works. Chrome is unaffected, because WordPress already handles it there.
One thing to know before you install: this works by turning on cross-origin isolation, which is a real security boundary and can affect embeds and third-party media inside the editor. It is worth reading the Tradeoffs section first.
WordPress 7.1 and Gutenberg include client-side media processing powered by WebAssembly (wasm-vips). This requires cross-origin isolation, which is achieved via Document-Isolation-Policy (DIP) on Chrome 137+.
However, Firefox and Safari do not yet support DIP, and neither does Chrome before 137, so client-side media processing is disabled on those browsers.
This plugin restores support by sending the older COEP/COOP headers on browsers where DIP is not available:
- Sends
Cross-Origin-Opener-Policy: same-originandCross-Origin-Embedder-Policy: credentialless(orrequire-corpon Safari) headers in the block editor. - On Safari (
require-corp), addscrossorigin="anonymous"to cross-origin images, scripts, styles, audio, and video so they can load through CORS. On Firefox (credentialless) nothing is added, because those resources already load without it and the attribute would break any host without CORS headers. - Applies the same rule to the media library templates, whose URLs are only known at render time, so the media modal previews match the isolation mode on whichever WordPress version is running.
- On WordPress 7.2 and later, also isolates the Media Library grid and the "Add New Media File" screen and loads WordPress's own upload scripts there, so uploads from those screens and from the media modal are processed in the browser too. WordPress only does this by itself on Chrome 137+.
- Adds
credentiallessattribute to iframes so they continue working under COEP. - Filters embed previews for providers that do not support credentialless iframes (Facebook, SmugMug).
Cross-origin isolation is a security boundary. It works by making the browser refuse cross-origin resources that have not opted in, or strip their credentials. That is what unlocks SharedArrayBuffer and wasm-vips, but it is also why Chrome moved to Document-Isolation-Policy: DIP gives the same isolation without imposing these restrictions on the rest of the page.
Scope of the impact. Only browsers that receive the COEP/COOP headers are affected - Firefox, Safari, and Chrome < 137 - and only on block editor screens (post editor, site editor, block widgets) and, on WordPress 7.2+, the Media Library grid and "Add New Media File" screens, for users who can upload files. The front-end, the rest of wp-admin, and Chrome 137+ are untouched.
What can break on those screens:
- oEmbed previews. Embeds are iframed. Under
credentialless(Firefox, Chrome < 137) the plugin adds thecredentiallessattribute so they still load, but without cookies - embeds that need a logged-in session render logged-out or not at all. Facebook and SmugMug do not work with credentialless iframes, so their live previews are disabled in the editor and the placeholder is shown instead. Safari does not supportcredentiallessat all, so underrequire-corpany embed whose provider does not send its own COEP header is blocked outright. - Media served from third-party origins. Images, video, audio, and fonts loaded into the editor from a CDN or another domain must opt in with
Cross-Origin-Resource-Policy. Undercredentiallessthey load but without credentials, so anything behind a signed cookie fails. Underrequire-corp(Safari) they are blocked unless the server sends CORP - the plugin addscrossorigin="anonymous"to cross-origin images, scripts, styles, audio, and video to give them a CORS path instead, which only helps if the server sendsAccess-Control-Allow-Origin. - Popup-based authentication.
Cross-Origin-Opener-Policy: same-originsevers thewindow.openerlink to cross-origin popups. Plugins that connect to an external service by opening an OAuth popup and waiting for it to call back into the opener will hang. - Plugins that load editor assets cross-origin. Any third-party script, stylesheet, or font pulled into the editor from another origin is subject to the same rules.
- The classic block. The classic block and other TinyMCE-based UIs commonly load third-party assets, and are a frequent place for the failures above to surface.
These are the same constraints the block editor lived with before Chrome shipped Document-Isolation-Policy. If you hit one, you can suppress the headers per environment or per user with the csme_use_coep_coop filter, or deactivate the plugin - media processing then falls back to the server on the affected browsers, which is the behavior without this plugin installed.
- WordPress 6.8+ with the Gutenberg plugin, or WordPress 7.1+.
- The client-side media processing feature must be enabled (it is on by default in secure contexts).
- A secure context: the site must be served over HTTPS (or from
localhost). Cross-origin isolation andSharedArrayBufferare unavailable otherwise, and the editor falls back to server-side processing.
- Upload the
client-side-media-everywherefolder to/wp-content/plugins/. - Activate the plugin through the Plugins menu in WordPress.
- The COEP/COOP headers activate automatically on browsers that need them.
The plugin has no settings screen: activating it is opting in to the COEP/COOP headers, and deactivating it turns them off.
To keep the plugin active but suppress the headers (for example, conditionally per environment or per user), use the csme_use_coep_coop filter:
add_filter( 'csme_use_coep_coop', '__return_false' );The filter receives the computed default (true on browsers that need COEP/COOP, false where Document-Isolation-Policy applies), so it can also be used for conditional logic:
add_filter(
'csme_use_coep_coop',
function ( $use_coep_coop ) {
if ( 'staging' === wp_get_environment_type() ) {
return false;
}
return $use_coep_coop;
}
);The PHP codebase is analyzed with PHPStan at level 5 (configured in phpstan.neon.dist). To run it locally:
composer install
composer phpstanPHPStan also runs in CI and fails the build on new errors. Fix reported issues with real type fixes (accurate docblocks, guards for false/null returns) rather than ignores - there is no baseline, and the goal is to keep it that way.
composer lintTo package the plugin for the WordPress.org plugin repository (or manual installation), run:
composer buildThis produces dist/client-side-media-everywhere.zip containing only the runtime files, with a single top-level client-side-media-everywhere/ directory as required by WordPress.org. Development files are excluded per .distignore - the same exclusion list used by the release deploy workflow.
This plugin is licensed under GPL-2.0-or-later.