You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Domain mapping fix_srcset applies the request's mapped domain to other sites' images after switch_to_blog #2131
Domain_Mapping::fix_srcset() (inc/class-domain-mapping.php, hooked on wp_calculate_image_srcset) rewrites every srcset URL with replace_url() using $this->current_mapping, the mapping of the request's host. Unlike mangle_url(), which returns early when $current_mapping->get_blog_id() !== get_current_blog_id(), fix_srcset() has no site check.
So when a request for mapped site A calls switch_to_blog(B) and renders B's images, B's srcset URLs get A's domain (https://site-a.example/app/uploads/sites/B/...), while src stays correct. On a production network (2026-11-21) this was cached in Elementor's _elementor_element_cache for four posts of one site. A CDN page-URL rewriter then replaced only the upload path, leaving A's host in front of the CDN URL (https://site-a.examplehttps://cdn.example/...), so the logo, banners and product images failed to load on every page of site B.
Fix
In fix_srcset(), return $sources unchanged unless $this->current_mapping->get_blog_id() === get_current_blog_id(), matching mangle_url(). Optionally, use the mapping for the current blog instead of returning early. Check the other filters registered in register_mapped_filters() for the same missing guard.
Files Scope
EDIT: inc/class-domain-mapping.php (fix_srcset(), around line 705)
Verification
On a multisite with a mapped domain for site A, request A's front end with code that runs switch_to_blog(B); echo wp_get_attachment_image($id_on_B, 'full'); restore_current_blog();. Before the fix, srcset URLs use A's domain; after it, they use B's own URLs.
Regression: images rendered on A itself still get A's mapped domain in srcset.
What: Prevent the request host's domain mapping from rewriting srcset URLs while rendering a different switched blog. Other mapped URL filters already route through mangle_url, which has target-site guards.
Testing: vendor/bin/phpcs inc/class-domain-mapping.php; vendor/bin/phpstan analyse inc/class-domain-mapping.php --no-progress; php -l inc/class-domain-mapping.php; git diff --check origin/main...HEAD. Runtime multisite verification was self-assessed because the worktree has no WordPress dev install or WordPress test suite.
Key decisions: none
aidevops.sh v3.39.189 plugin for OpenCode v1.19.5 with gpt-5.6-sol spent 3m and 70,126 tokens on this as a headless worker.
Merged via PR #2153 to main. Merged by deterministic merge pass (pulse-wrapper.sh).
Activity
superdav42 commentedon Nov 25, 2026
DISPATCH_CLAIM nonce=22f73b391154c889bdad080f6aa42f8c runner=superdav42 ts=2026-11-25T18:52:54Z max_age_s=1800 version=3.39.189 opencode_version=1.18.31 lease_token=22f73b391154c889bdad080f6aa42f8c device=device-1783824528-2609248-26808 session=issue-2131 phase=prelaunch expires_at=1795632896
superdav42 commentedon Nov 25, 2026
DISPATCH_LEASE phase=prelaunch lease_token=22f73b391154c889bdad080f6aa42f8c device=device-1783824528-2609248-26808 session=issue-2131 expires_at=1795633242 ts=2026-11-25T18:53:12Z attempt_id=attempt:2b47d076-84b6-4264-a914-5ad2e03126e5
superdav42 commentedon Nov 25, 2026
DISPATCH_LEASE phase=prelaunch lease_token=22f73b391154c889bdad080f6aa42f8c device=device-1783824528-2609248-26808 session=issue-2131 expires_at=1795633243 ts=2026-11-25T18:53:49Z attempt_id=attempt:2b47d076-84b6-4264-a914-5ad2e03126e5
superdav42 commentedon Nov 25, 2026
Dispatching worker (deterministic).
superdav42 commentedon Nov 25, 2026
DISPATCH_LEASE phase=ready lease_token=22f73b391154c889bdad080f6aa42f8c device=device-1783824528-2609248-26808 session=issue-2131 expires_at=1795640043 ts=2026-11-25T18:54:03Z attempt_id=attempt:2b47d076-84b6-4264-a914-5ad2e03126e5
aidevops.sh v3.39.189 automated scan.
superdav42 commentedon Nov 25, 2026
CLAIM_RELEASED reason=worker_complete runner=superdav42 ts=2026-11-25T18:59:31Z aidevops_version=3.39.189 opencode_version=1.18.31 claim_id=7171531122 nonce=22f73b391154c889bdad080f6aa42f8c lease_token=22f73b391154c889bdad080f6aa42f8c device=device-1783824528-2609248-26808 session=issue-2131
aidevops.sh v3.39.189 plugin for OpenCode v1.18.31
superdav42 commentedon Nov 25, 2026
Completion Summary
aidevops.sh v3.39.189 plugin for OpenCode v1.19.5 with gpt-5.6-sol spent 3m and 70,126 tokens on this as a headless worker.
Merged via PR #2153 to main.
Merged by deterministic merge pass (pulse-wrapper.sh).
Routing feedback
standard; 1 attempt, 23 LLM requests, 0 capability escalations, 1 same-tier fallback.