Title: Bug with WP ROCKET (plugin cache)
Last modified: April 15, 2023

---

# Bug with WP ROCKET (plugin cache)

 *  Resolved [plop6901](https://wordpress.org/support/users/plop6901/)
 * (@plop6901)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/)
 * Hello,
   I have a problem with your plug in, especially with the mobile display.
   I think it comes from my WPROCKET cache plugin. Can you help me?On computer, 
   the site displays as a white flash when loading a page. And on mobile, the dark
   mode is not activated until the page is scrolled. I think it is due to the delay
   of the javascript. Could you help me to put the right exclusions in WPROCKET 
   please?Thanks a lot
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fbug-with-wp-rocket-plugin-cache%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  Plugin Support [toukirwpdev](https://wordpress.org/support/users/toukirwpdev/)
 * (@toukirwpdev)
 * [3 years, 1 month ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-16692453)
 * The “WP Dark Mode” plugin with the wp-rocket plugin on [mobile screens](https://share.vidyard.com/watch/uajAKtFnum1HjcgrTxqH9q?),
   appears to be functioning well. Would you mind sharing which mobile device you
   are currently using? It’d be awesome if you can record a short loom video or 
   similar illustrating the issue you are experiencing.
 *  [unrestricted](https://wordpress.org/support/users/unrestricted/)
 * (@unrestricted)
 * [3 years ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-16775460)
 * I have the exact same bug. On every page visit it switches from light mode to
   dark mode. Basically, a white flash as plop6901 describes it and the same thing
   happens on mobile. I am using the Free version with the Total Cache plugin, a
   different caching plugin. I disabled the caching plugin and it still does the
   same thing.
 *  Plugin Support [toukirwpdev](https://wordpress.org/support/users/toukirwpdev/)
 * (@toukirwpdev)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-16778303)
 * We apologize for this inconvenience. We are aware of the flashing issue and are
   working on resolving it as soon as possible. We will be implementing a new technology
   to address this issue. Once resolve this issue we’ll let you know.
 * Thanks for understanding and patience!
 *  [unrestricted](https://wordpress.org/support/users/unrestricted/)
 * (@unrestricted)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-16784966)
 * Any idea when this update will be released? I am looking to purchase the PRO 
   version once I can confirm the bug has been tested and fixed.
 *  Thread Starter [plop6901](https://wordpress.org/support/users/plop6901/)
 * (@plop6901)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-16856635)
 * Hello,
 * Has a solution been found?
 * Thanks in advance!
 *  [fidoboy](https://wordpress.org/support/users/fidoboy/)
 * (@fidoboy)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17213488)
 * This could be solved by editing the file class-hooks.php and adding the tag “
   nowprocket” to the inline script there (around line 198). It avoids that WP Rocket
   plugin delay or defer the execution.
 * May be someone should inform of this incompatibility issue to the WP Rocket team
   or may be that developers of WP Dark Mode plugin here could simply add some checks
   to his plugin if that cache plugin is enabled. As always it can be solved in 
   both ways.
 * I believe it’s more simple if this plugin adds some checks and adjusts if there
   is cache plugins working in WordPress, like WP Rocket, to inform the user and/
   or make the convenient changes.
    -  This reply was modified 2 years, 6 months ago by [fidoboy](https://wordpress.org/support/users/fidoboy/).
 *  Thread Starter [plop6901](https://wordpress.org/support/users/plop6901/)
 * (@plop6901)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17264613)
 * Thanks for your answer [@fidoboy](https://wordpress.org/support/users/fidoboy/)
 * could you please tell me how to do that? or share with me the line of code you
   inserted?
 *  [fidoboy](https://wordpress.org/support/users/fidoboy/)
 * (@fidoboy)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17264669)
 * I think that I already deleted the code that I’ve used to solve this problem.
   But if I’m not wrong, it’s as simple as adding the class “nowprocket” in that
   line and some others into the same script. If it doesn’t work that way, then 
   try adding “?nowprocket” to the script URL (I can’t remember right now if it 
   was inline code or a url to load a javascript file).
    -  This reply was modified 2 years, 5 months ago by [fidoboy](https://wordpress.org/support/users/fidoboy/).
 *  [fidoboy](https://wordpress.org/support/users/fidoboy/)
 * (@fidoboy)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17264675)
 * [@plop6901](https://wordpress.org/support/users/plop6901/) just open that file
   with an editor and look at the line that I’ve posted before. You’ll see some 
   HTML code to insert a script. Add class=”nowprocket” and then look for one or
   two pieces into the same file with almost the same code that in that line. Just
   add the required class to each one. With this you will avoid that the WP Rocket
   plugin could defer or delay the javascript from WP Dark Mode.
    -  This reply was modified 2 years, 5 months ago by [fidoboy](https://wordpress.org/support/users/fidoboy/).
 *  [fidoboy](https://wordpress.org/support/users/fidoboy/)
 * (@fidoboy)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17264688)
    1. Edit the file **/wp-content/plugins/wp-dark-mode/includes/class-hooks.php**
    2. Locate line 198 and change this:
 *     ```wp-block-code
       <script>
       ```
   
 * Into this:
 *     ```wp-block-code
       <script nowprocket>
       ```
   
 * 3. Look for other lines in the same file where you can see <script> to make the
   same change than in step 2.
 *  4. Save the changes.
 * Solved.
 *  [fidoboy](https://wordpress.org/support/users/fidoboy/)
 * (@fidoboy)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17264691)
 * [@plop6901](https://wordpress.org/support/users/plop6901/) you’ll also need to
   add the javascript files into the textarea in WP Rocket settings screen to exclude
   all of them from being defered or delayed. It’s a simple as copy & paste the 
   filenames including the path (starting from /wp-content/plugins/…). You can get
   them from the browser and opening developer tools and locating the wp-dark-mode
   scripts into the network tab.
    -  This reply was modified 2 years, 5 months ago by [fidoboy](https://wordpress.org/support/users/fidoboy/).
 *  Plugin Support [Md. Ibrahim Khalil](https://wordpress.org/support/users/mdibrahimk48/)
 * (@mdibrahimk48)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17442119)
 * Hi there,
 * Thanks for your patience! We’ve resolved the issue with our latest update **(
   WP Dark Mode v5.0)**, which also brings some exciting new features. Please update
   your plugin and check if the problem is fixed.
 * **If you need more help, don’t hesitate to start a new thread.**
 * Have a great day! Thank You!
 *  Thread Starter [plop6901](https://wordpress.org/support/users/plop6901/)
 * (@plop6901)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17463273)
 * Hello,
 * The probeme is still present. In fact, I notice that when I change the page on
   my site, the dark mode button deactivates and reactivates instantly, creating
   a flash.

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

The topic ‘Bug with WP ROCKET (plugin cache)’ is closed to new replies.

 * ![](https://ps.w.org/wp-dark-mode/assets/icon-256x256.gif?rev=2872214)
 * [WP Dark Mode - Improve Accessibility with AI Powered Dark Theme](https://wordpress.org/plugins/wp-dark-mode/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-dark-mode/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-dark-mode/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-dark-mode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-dark-mode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-dark-mode/reviews/)

## Tags

 * [defer](https://wordpress.org/support/topic-tag/defer/)
 * [delay](https://wordpress.org/support/topic-tag/delay/)
 * [incompatibility](https://wordpress.org/support/topic-tag/incompatibility/)
 * [javascript](https://wordpress.org/support/topic-tag/javascript/)
 * [WP Rocket](https://wordpress.org/support/topic-tag/wp-rocket/)

 * 13 replies
 * 5 participants
 * Last reply from: [plop6901](https://wordpress.org/support/users/plop6901/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/bug-with-wp-rocket-plugin-cache/#post-17463273)
 * Status: resolved