Site logo

Archived topic

Generate Press JS not being deferred.

7 replies · Started by Joel on December 2, 2021

Viewing posts 1–8 of 8

Hi, I'm not sure what the exact cause is, but it looks like the JS related to Generate Press is no longer being deferred by WP Rocket.

I've used both for a couple of years and the JS was always deferred or otherwise didn't appear when I checked the site through GT Metrix or similar sites.

For the last couple of months, however, the GP JS has started showing up.

I recently activated Cloudflare, so I'm not sure if it's related to that, but it seems to be adding a lot of extra JS requests to my site and I was wondering if you're aware of a conflict between GP, WP Rocket, or Cloudflare that might cause this?

Hi Joel,

Consider purging the current cache of WP Rocket so it generates a new one. After this, purge Cloudflare's cache as well so it uses the current latest setting of your site.

As for specific configurations, make sure to check WP Rocket's defer exclusion if you've added paths or GP scripts in it. https://docs.wp-rocket.me/article/976-exclude-files-from-defer-js

Hi, thanks for the quick reply.

I've purged both the WP Rocket cache and Cloudflare cache in the past, so I don't think it's anything to do with that as the issue came up before and after those times.

As for the defer exclusion, the only thing that should be deferred is jquery, as per the script below:

(?:/wp-content|/wp-includes/)(.*)
/jquery-?[0-9.](.*)(.min|.slim|.slim.min)?.js
js-(before|after)

Is that likely to interfere with GP JS?

Hi there,

GP only uses jQuery for the Sticky Navigation, so if you don't have that enabled then GP won't have a problem if jQuery is deferred.

Hi,

Nothing seems to have changed at all and my site is still showing lots of JS for Generate Press that didn't use to be there at all.

I don't think this has anything to do with JQuery, I was just mentioning that that's the only thing I've got excluded from defer JS in WP Rocket.

There's still a lot of JS that appears in the GT Metrix waterfall that doesn't seem to be deferred like it used to. I'm not sure if this is an issue or not, but I'm concerned it might be slowing down my site or not loading correctly.

Any ideas?

I can see 14 JS requests - of which 4 belong to GP ( sticky nav, off canvas panel, navigation search and back to top ) - but none of your JS files look to be deferred. Have you checked with WP Rocket as its their plugin that does the deferring?

Hello, I've mailed WP Rocket but still waiting to hear back. I guess you're not aware of any potential conflicts between GP and WP Rocket that might cause the JS to be deferred then?

Hopefully I can get some answers from WP Rocket about it.

Thanks for your help.

There should be no conflicts. GP abides by WP Coding Standards, and plenty of WP Rockets use that feature. It sounds like something in the settings just needs adjusting.

This archived topic is closed to new replies.