[wp-trac] [WordPress Trac] #64294: WooCommerce Blocks: Wrong domain in wp_resource_hints on multisite due to network-level cache (woocommerce_block_asset_resource_hints)
WordPress Trac
noreply at wordpress.org
Mon Nov 24 18:37:28 UTC 2025
#64294: WooCommerce Blocks: Wrong domain in wp_resource_hints on multisite due to
network-level cache (woocommerce_block_asset_resource_hints)
--------------------------+------------------------------
Reporter: margelatu | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 6.8.3
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by maulikmakwana2008):
Create this MU-plugin file:
{{{#!php
<?php
/**
* Plugin Name: Fix – WooCommerce Blocks Prefetch on Multisite
* Description: Forces WooCommerce Blocks to use per-site transients
instead of network-wide transients for resource hints.
* Author: Core Tickets Patch
* Version: 1.0
*/
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* WooCommerce Blocks incorrectly uses site transients (network-wide)
* to cache resource hints. This causes the wrong domain to appear
* on multisite installs with multiple domains.
*
* This patch reroutes the cache reads/writes to per-site transients.
*/
add_filter( 'pre_site_transient_wc_blocks_resource_hints', function(
$value ) {
// Read from per-site transient instead
return get_transient( 'wc_blocks_resource_hints' );
});
add_filter( 'pre_set_site_transient_wc_blocks_resource_hints', function(
$value ) {
// Save into per-site transient instead of network transient
set_transient( 'wc_blocks_resource_hints', $value, DAY_IN_SECONDS );
// Stop WP from saving it again as a network transient
return null;
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64294#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list