Title: sg_cachepress_purge_cache issue
Last modified: February 13, 2024

---

# sg_cachepress_purge_cache issue

 *  Resolved [fluxbe](https://wordpress.org/support/users/fluxbe/)
 * (@fluxbe)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/sg_cachepress_purge_cache-issue/)
 * Hi
 * We have a faux multisite setup, so instead of a multisite, we use a Custom Post
   Type (website) to store information about each subsite (like a website_url meta
   field etc).
 * Whenever a website post is saved, we call the `sg_cachepress_purge_cache( $website_url);`
   function to clear the cache. But this does only clear the cache for the main 
   website URL.
   Let’s say I have these websites: website.com, x.website.com and 
   y.website.com. If my admin is logged in on website.com (main website) and is 
   editing the post of x.website.com, we execute this after saving the post: `sg_cachepress_purge_cache('
   https://x.website.com/' );`
 * But when we then navigate to x.website.com, the changes we made are not visible
   and a previously cached version is shown.
 * After some digging, I found out that the `Supercacher::purge_cache_request( $
   url, $include_child_paths );` function is executed. In this function the hostname
   is parsed from the `home_url();` and not from the url parameter. Then the `Supercacher::
   flush_dynamic_cache( $hostname, $main_path, $url );` function is executed.
   In
   my case, the flush_dynamic_cache would look like this:
 *     ```wp-block-code
       Supercacher::flush_dynamic_cache( 'website.com', '/(.*)', 'https://x.website.com/' )
       ```
   
 * And it should be this (based on the URL):
 *     ```wp-block-code
       Supercacher::flush_dynamic_cache( 'x.website.com', '/(.*)', 'https://x.website.com/' )
       ```
   
 * For now I was able to fix this by directly calling the flush_dynamic_cache function
   after a post save like this:
 *     ```wp-block-code
       \SiteGround_Optimizer\Supercacher\Supercacher::flush_dynamic_cache( 'x.website.com', '/(.*)', 'https://x.website.com/' );
       ```
   
 * Is is intended that the hostname gets parsed from the home_url? Because I would
   like to use `sg_cachepress_purge_cache( 'https://x.website.com/' );`, so it makes
   more sense to me that the hostname should be parsed from the URL I provided.
 * Is is also possible to flush the dynamic cache of multiple subsites (parked domains)
   in one request? Something like this: `flush_dynamic_cache( '*.website.com', '/(.*)');`
   
   Thanks!

Viewing 1 replies (of 1 total)

 *  Plugin Support [Gergana Petrova](https://wordpress.org/support/users/gpetrova/)
 * (@gpetrova)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/sg_cachepress_purge_cache-issue/#post-17439681)
 * Hello [@fluxbe](https://wordpress.org/support/users/fluxbe/),
 * Our plugin is designed to work primarily with standard WordPress installations
   and does not natively support the faux multisite setup you’ve described. 
   I understand
   that you’re using a custom post type to simulate a multisite environment and 
   are looking to clear the cache for individual “subsites” when their respective
   posts are updated. Your approach to directly call the `flush_dynamic_cache` function
   is indeed a possible workaround given the default setup of our plugin. As for
   your question regarding the possibility of flushing the dynamic cache of multiple
   subsites in one request, our system does not support wildcard purging like *.
   website.com either.This topic has already been brought to the attention of our
   plugin’s developers for possible future enhancement to the functionalities available,
   however I cannot offer an ETA for when or if this will be considered.Best Regards,
   Gergana Petrova

Viewing 1 replies (of 1 total)

The topic ‘sg_cachepress_purge_cache issue’ is closed to new replies.

 * ![](https://ps.w.org/sg-cachepress/assets/icon-256x256.gif?rev=2971889)
 * [Speed Optimizer - The All-In-One Performance-Boosting Plugin](https://wordpress.org/plugins/sg-cachepress/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-cachepress/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-cachepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-cachepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-cachepress/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Gergana Petrova](https://wordpress.org/support/users/gpetrova/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/sg_cachepress_purge_cache-issue/#post-17439681)
 * Status: resolved