Title: Problem With Newly Published Posts Breaking Theme Script
Last modified: February 19, 2017

---

# Problem With Newly Published Posts Breaking Theme Script

 *  [valhalla1](https://wordpress.org/support/users/valhalla1/)
 * (@valhalla1)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/problem-with-newly-published-posts-breaking-theme-script/)
 * Hi,
 * Great app!
 * Have one minor problem related to it on [https://www.hiddendominion.com](https://www.hiddendominion.com)
 * When I first publish a new article, the page breaks. By “break” I mean the entire
   theme (JS or CSS maybe) is not loaded. It’s just strict text on the left side.
   So images, sidebar, theme, nothing. So, it’s the typical text only “page-break”.
   Now I use WP super cache and varnish, so there may be a conflict.
 * However, as soon as I empty the AO cache, it looks perfect. But this means every
   time I write a post, it looks terrible until I can empty the cache. It does not
   seem to effect ANY posts in the past, just immediately newly published ones.
 * Oddly, this does not happen when i’m logged in as an admin. I have it set to 
   show admins only uncached pages.
 * I check to make sure it looks good in a different browser as an anonymous user.
   And obviously, it never does until I empty the cache.
 * So what I’m imagining is happening is that the WP super cache and AO is running
   into a conflict.
 * Do you have any recommendations on how I could fix this? Or if I should just 
   try and find a way to auto-empty autooptimize cache on new post?
 * Thanks for your time.
 * HD

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [valhalla1](https://wordpress.org/support/users/valhalla1/)
 * (@valhalla1)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/problem-with-newly-published-posts-breaking-theme-script/#post-8823631)
 * Sidenote: Forgot to add, I have Varnish and WP Super Cache setup to automatically
   clear their caches on new post. I noticed AO doesn’t have a setting for that,
   so maybe that has something to do with my problem?
 * Thanks again!
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/problem-with-newly-published-posts-breaking-theme-script/#post-8824148)
 * morning [@valhalla1](https://wordpress.org/support/users/valhalla1/);
    interesting
   problem 🙂
 * The “Clear all cache files when a post or page is published or updated.”-option
   in WPSC actually removes everything in `wp-content/cache`, including the autoptimize
   cache. I’ve tried reproducing your bug, but have not been able to, but I don’t
   have Varnish on my setup so that might have to do with it.
 * But the fact that all posts work except the newly published one seems to indicate
   that the new post (and it’s JS/ CSS) is cached (in Varnish) _before_ the AO-cache
   gets removed (by WPSC). So if you are in fact first purging Varnish and then 
   WPSC, try switching and see if this changes anything?
 * hope this helps,
    frank
 *  Thread Starter [valhalla1](https://wordpress.org/support/users/valhalla1/)
 * (@valhalla1)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/problem-with-newly-published-posts-breaking-theme-script/#post-8828565)
 * > So if you are in fact first purging Varnish and then WPSC, try switching and
   > see if this changes anything?
 * Do you have any recommendations on how to accomplish this? Will I need to add
   some code into htaccess to tell varnish to wait for a certain timeframe before
   purge? Tried googling – not much help on how to delay the purge.
 * Thanks for the help! I think that would help it.
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [9 years, 3 months ago](https://wordpress.org/support/topic/problem-with-newly-published-posts-breaking-theme-script/#post-8828826)
 * I’m not familiar with Varnish myself I’m afraid, how do you make sure its cache
   is purged? Have you tried purging it manually after the problem arises?

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Problem With Newly Published Posts Breaking Theme Script’ is closed to
new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [9 years, 3 months ago](https://wordpress.org/support/topic/problem-with-newly-published-posts-breaking-theme-script/#post-8828826)
 * Status: not resolved