{"id":19041829,"date":"2026-10-10T21:59:42","date_gmt":"2026-10-10T21:59:42","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/cache-invalidation-with-multiple-domains-on-one-wordpress-installation\/"},"modified":"2026-10-10T21:59:42","modified_gmt":"2026-10-10T21:59:42","slug":"cache-invalidation-with-multiple-domains-on-one-wordpress-installation","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/cache-invalidation-with-multiple-domains-on-one-wordpress-installation\/","title":{"rendered":"Cache invalidation with multiple domains on one WordPress installation"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi Breeze team,<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, thanks for the great plugin! I&#8217;ve recently switched from WP Super Cache to Breeze and I&#8217;m very happy with it so far.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I noticed a small issue when using two domains for the same WordPress installation (<code>example.at<\/code> as the primary domain and <code>example.de<\/code> as an additional domain).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Breeze correctly creates and serves separate caches for both domains. However, when updating a page or product, only the cache for the primary domain is invalidated. The cached version on the second domain remains unchanged.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Looking at the code, it seems that <code>collect_urls_for_cache_purge()<\/code> collects URLs based on the primary WordPress domain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I found a simple workaround using the existing <code>breeze_collect_urls_for_cache_purge<\/code> filter to add the corresponding URLs for the second domain. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I understand that supporting multiple domains on a single WordPress installation may be an uncommon setup, but maybe my feedback helps.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks again for your work!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">My current workaround:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>add_filter( 'breeze_collect_urls_for_cache_purge', function ( $urls ) {<br>    $domains = [<br>        'www.example.at',<br>        'www.example.de',<br>    ];<br><br>    foreach ( $urls as $url ) {<br>        $host = wp_parse_url( $url, PHP_URL_HOST );<br><br>        if ( in_array( $host, $domains, true ) ) {<br>            foreach ( $domains as $domain ) {<br>                $urls[] = str_replace( $host, $domain, $url );<br>            }<br>        }<br>    }<br><br>    return array_unique( $urls );<br>} );<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-19041829","topic","type-topic","status-publish","hentry","topic-tag-invalidation"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19041829","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/19041829\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=19041829"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}