Wp-rocket: Jupiter theme compat

Created on 24 Apr 2017  Â·  13Comments  Â·  Source: wp-media/wp-rocket

There are 2 main issues with the Jupiter theme (v5.9):

  • It sets DONOTCACHEPAGE, DONOTMINIFY, and DONOTCDN in various places.
  • It has its own theme cache that needs WP Rocket would need to purge upon a cache update.

Constants preventing WP Rocket functionality

Jupiter sets various constants in Mk_Static_Files::prevent_cache_plugins() that prevent caching, minification and delivery of files via CDN:

static function prevent_cache_plugins() {
if ( !defined( 'DONOTCACHEPAGE' ) )
define( 'DONOTCACHEPAGE', true );

if ( !defined( 'DONOTCACHCEOBJECT' ) )
define( 'DONOTCACHCEOBJECT', true );

if ( !defined( 'DONOTMINIFY' ) )
define( 'DONOTMINIFY', true );

if ( !defined( 'DONOTCACHEDB' ) )
define('DONOTCACHEDB', true);

if ( !defined( 'DONOTCDN' ) )
define('DONOTCDN', true);

}

That method gets called when the theme:

  • outputs inline dynamic global assets (Mk_Static_Files::inline_dynamic_global_assets())
  • sets the dynamic theme options (Mk_Static_Files::dynamic_theme_options())
  • enqueues Google fonts (Mk_Static_Files::mk_enqueue_fonts())
  • adds critical styles in the header (Mk_Static_Files::critical_path_css())

I haven’t tested this in great detail, but from the looks of it it is probably fair to say that whatever Jupiter does in terms of static files, it doesn’t want caching plugins to cache or minify or deliver via CDN.

This is, of course, a showstopper for WP Rocket. We have seen various support tickets where people complained about caching and/or minification not working.

Would we want to work with Artbees to solve this dilemma?
If not, we should probably think about listing the theme as incompatible with WP Rocket.

Cache management

If the constants issue could be resolved, we could in theory make sure that WP Rocket triggers a purge of Jupiter’s theme cache upon any cache update of its own. However, currently this doesn’t seem possible.

Jupiter uses a function named mk_purge_cache_actions() to purge its cache. At the end of that function they call another function named mk_clear_cache_plugins() inside of which they trigger rocket_clean_domain().

So they make sure they purge WP Rocket’s cache whenever they purge their own. Nice move! But vice versa?

Unfortunately, we cannot use mk_purge_cache_actions() in WP Rocket, because we would create an infinite loop of cache purging. We would call their function which calls ours which calls theirs … and so on.

A way around this would be if Jupiter introduced a new function—for example named mk_purge_theme_cache_actions()—which would contain all their theme cache purging actions, but no further plugin cache purging, so WP Rocket would be able to use it.

Then they could turn their existing function mk_purge_cache_actions() in to a wrapper which would contain mk_purge_theme_cache_actions() as well as mk_clear_cache_plugins(), so they could continue using mk_purge_cache_actions() just like before.

In abstract:

/**
* New Jupiter function: purge only theme cache.
* To be used by WP Rocket.
*/
function mk_purge_theme_cache_actions( $remove = false ) {

// purge theme cache
}

/**
* Existing Jupiter function: purge plugin caches.
*/
function mk_clear_cache_plugins() {

// purge plugin caches
}


/**
* Existing Jupiter function name, but content refactored as a wrapper.
*/
function mk_purge_cache_actions() {

// purge theme cache
mk_purge_theme_cache_actions();

// purge plugin caches
mk_clear_cache_plugins();
}

Given that the issues with constants could be resolved, would we want to add Jupiter to our integrated 3rd-party cache management?
If so, we could propose the adjustments outlined above to them as a starting point.

3rd party compatibility

Most helpful comment

Hey there,

Jupiter dev is here.

Thank you very much for detailed report. I believe this is a bug from Jupiter with the recent changes with google fonts options.

If it's possible could you please kindly send me an e-mail mirza (at) artbees.net or add me on skype mirza.zeyrek. I think we can solve this without any extra effort from you guys.

This "prevent cache" feature supposed to work only for the first load and after that cache plug-ins should work fine.

All 13 comments

Hey there,

Jupiter dev is here.

Thank you very much for detailed report. I believe this is a bug from Jupiter with the recent changes with google fonts options.

If it's possible could you please kindly send me an e-mail mirza (at) artbees.net or add me on skype mirza.zeyrek. I think we can solve this without any extra effort from you guys.

This "prevent cache" feature supposed to work only for the first load and after that cache plug-ins should work fine.

@mirzazeyrek Thanks for chiming in, feel free to shoot us an email at contact [at] wp-rocket [dot] me any time.

I might post an update on this issue it once we have a solution.

@glueckpress any update on progress here? I wasted hours on this before I discovered Jupiter was doing this.. glad to see @mirzazeyrek is also on the case.

It's not only WP Rocket that is the issue, but any WP caching...

Sorry for the update.. but I just found this: https://themes.artbees.net/docs/5-ways-to-increase-website-speed/

Artbees need to sort out this issue as they recommend a caching plugin as a way to increase website speed, yet currently Jupiter doesn't support any caching plugins???

@xyzulu We are in contact with Artbees and will post an update here once we can make a clear statement on the state of compat between WP Rocket and Jupiter.

Thanks for the feedback.
I notice that 5.9.1 is supposed to fix a cache issue.. is there more to it than that?

@xyzulu Please turn to Artbee’s channels of communication when you have questions about their product.

This GitHub issue refers to the question if/how we should/can improve compatibility with the Jupiter theme from our end. That question is currently pending, because we’re waiting for an update just like you.

Noted. I was hoping another voice on this issue might help it get the attention it deserves.
All the best!

@xyzulu I can officially confirm this issue has nothing to do with WP-Rocket.

Unfortunately 5.9.1 fixed it only partially (for visitors and subscribers). Problem will be totally fixed with new release probably on next week.

For now, I can provide a manual fix. Modify this method starting from line 877 in frameworkfunctions\dynamic-styles.php:

original:

    static function user_level_for_inline_styles() {
        if(wp_get_current_user()->user_level > 0)
            return true;
        if (current_user_can('administrator') || current_user_can('super_admin'))
            return true;
        return false;
    }

modified:

    static function user_level_for_inline_styles() {
        return false;
    }

Modified file is also attached. Other option is going back to 5.8 until next release.

Sorry for the inconvenience and thank you for bearing with us. Please let me know if that works for you. If you need further support you can reach me at from mirza (at) artbees (dot) net

dynamic-styles.zip

Hi,

thanks for the corrected lines. It works well now but only on the desktop and mobile version.
The tablet version is completly white on an ipad. I have uncrossed all the option but the problem remain the same.

Thanks for your help

www.vexinmontgolfiere.fr

Laurent

@lihoooo While we appreciate @mirzazeyrek sharing possible workarounds regarding this issue, just as we appreciate general development-oriented feedback from everyone, please keep in mind that GitHub issues are not a support tickets.

We kindly ask everyone to turn to _Artbee’s_ own channels of communications in order to solve any individual problems with Jupiter.

This thread is supposed to serve develop-oriented communication on the issue outlined above.

Hey, was it fixed ? I've got the exact same problem right now, just a different cache plugin (W3 Total Cache). For now, I've commented the define lines, but it's an ugly fix.

@alexisattimont There wasn’t and isn’t anything to fix in WP Rocket. Please respect the scope of this issue.

Was this page helpful?
0 / 5 - 0 ratings