With this enhancement our users will be able to use WP Rocket’s features on uncached pages.
Currently these features ARE available on uncached pages:
We could safely add the following features as well:
Users will be able to turn some of these off on a post by post basis.
Currently if a page is excluded from WP Rocket cache, most optimizations are not applied to the excluded page. Uncached pages can still benefit from WP Rocket with the other features we have.
Test site: http://mega.wp-rocket.me/
The main purpose of the test is to see if any of our options are massively slowing down the load time. The homepage barely has assets or images that could greatly benefit from our optimizations.
Control test: WP Rocket disabled
Fully loaded time average: 2.44s (#1, #2, #3, #4, #5)
For the rest of the tests, WP Rocket page caching is disabled using our helper plugin.
Test with WP Rocket enabled but all options are disabled.
Fully loaded time average: 2.46s (#1, #2, #3, #4, #5)
Test with Optimize Google Fonts, Optimize CSS delivery, Remove jQuery Migrate and Defer JS (safe mode) enabled.
Fully loaded time average: 2.52s (#1, #2, #3, #4, #5)
Along with the options in the previous test, LazyLoad(images and iframe), Disable Emoji and Disable Emeds was enabled.
Fully loaded time average: 2.22s (#1, #2, #3, #4, #5)
Along with the options in the previous test, enabled minification for CSS and minification for JS
Fully loaded time average: 2.34s (#1, #2, #3, #4, #5)
Along with the options in the previous test, combination of CSS and combination of JS was enabled
Fully loaded time average: 2.36s (#1, #2, #3, #4, #5)
To reconfirm this, I used a test page with a lot more assets and images: http://smashingcoding.com/2020/06/01/lighthouse/
Control test: WP Rocket disabled
Fully loaded time average: 6.12s (#1, #2, #3, #4, #5)
For the rest of the tests, WP Rocket page caching is disabled using our helper plugin.
Test with WP Rocket enabled but all options are disabled.
Fully loaded time average: 5.86s (#1, #2, #3, #4, #5)
Test with Optimize Google Fonts, Optimize CSS delivery, Remove jQuery Migrate and Defer JS (safe mode) enabled.
Fully loaded time average: 5.44s (#1, #2, #3, #4, #5)
Along with the options in the previous test, LazyLoad(images and iframe), Disable Emoji and Disable Embeds was enabled.
Fully loaded time average: 4.26s (#1, #2, #3, #4, #5)
I did another 13 tests to confirm and the average fully loaded time was (13 tests): 3.94s
Combined average (13+5 = 18 tests): 4.02s
Along with the options in the previous test, enabled minification for CSS and minification for JS
Fully loaded time average: 4.35s (#1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, #15)
Along with the options in the previous test, combination of CSS and combination of JS was enabled
Fully loaded time average: 4.52s (#1, #2, #3, #4, #5, #6, #7, #8, #9, #10, #11, #12, #13, #14, #15)
Notes:
Based on the data above, it’s best not to enable CSS minification and combination on uncached pages. Here are the features that won’t be available on uncached pages.
We can easily take advantage of our existing WP Rocket meta box (with some changes) to do this feature.
This is how WP Rocket meta box looks like right now:
Right now:
This creates a potential problem if the new features are applied to uncached pages automatically when a customer updates to the new WP Rocket version.
To accommodate our existing users and mitigate this problem, we can have a two step approach.
Recommended changes to the WP Rocket meta box in the post editor.
A note on auto-exclusions
WP Rocket auto exclusions like WooCommerce cart, account and checkout pages for example are not reflected in the WP Rocket UI and are added directly to the config file. In the meta box for these pages, “Never cache this page” is never checked, nor are these pages listed in “Never Cache URL(s)” in the advanced tab.
Handling opt-in for existing users
Similar to how we handled this in “CPCSS for Mobile”, we could provide an opt-in “tool” in the Tools tab of WP Rocket.
The goal of this tool is to:
Spec for the tool in the “Tools” tab:
Description: Uncached pages on your website are excluded from all WP Rocket features. Click the button to enable certain WP Rocket features on uncached pages.
This is a one-time action and this button will be removed afterwards. More info
The following pages will be affected:
Button color: Blue
We are handling any potential risk by making this feature opt-in for existing customers.
For new customers and for customers who opt-in to this feature, most of the features that could potentially break a website can be individually disabled via the meta box.
Features that are not available in the meta box namely, “Optimize Google Fonts”, “Remove jQuery Migrate”, “Prefetch DNS”, “Preload for fonts”, “Google Tracking Add-on”, “Facebook Pixel Add-on”, are typically sitewide and are unlikely to cause an issue on a specific page. If this becomes an issue, we can offer helper plugins to disable this, or add this to the meta box if a huge number of customers face issues.
Is uncached = logged-in with no user cache too? Or is it only pages excluded from cache in our configuration?
@Tabrisrp I would stick with pages specifically excluded from cache. Otherwise users will not have an option to disable these settings.
Let's first do it for uncached pages and not for logged-in users.
(.*) regex?@Tabrisrp Are the questions for Arun / me or the dev team?
@webtrainingwheels Why do you think about doing it only for uncached pages? Should we also do it for logged-in users? What are the user feedback on support about that?
It seems like a product question. I forgot the consider these.
How to handle pages excluded using the (.*) regex?
example.com/post/(.*) is excluded and lets say example.com/post/ has a metabox, then use those settings. How to handle URLs than don't have the metabox available?
@GeekPress @webtrainingwheels what do you think?
Will it be possible to default to the settings of the base specified? OR is that too complicated?
I believe it's possible, we'll have to discuss this with the dev team. It does increase complexity of course, but if we are aware of that before starting, we can manage it.
How can we identify if a page has a metabox or not?
Well it's any type of content that is not a post of any type. Mainly terms. They are used a lot but don't have a way to be configured individually.
Thanks, Jo! I love this idea! I've proposed this in some nonces related issues where the only option was to exclude the pages from the cache.
And I would vote for enabling the optimizations for uncached pages for logged-in users only when the User Cache is enabled.
Because I guess that no cache and no optimizations sounds like the _default_ meaning of having the User Cache feature disabled.
@GeekPress For me personally, nothing should be applied for logged-in users, unless they have enabled User Cache.
I think the lack of minify/combine here will disappoint customers. I agree we don't want to add those features if they make the pages slower. In the future it would be great to optimize those features to make it possible.
@camilamadronero @webtrainingwheels Thanks for the reminder, I totally forget the « User Cache » option 😱
You're right, let's keep the current behavior for logged-in users!
@wp-media/wprocketplugin @hellofromtonya I suppose you have all infos for splitting this epic card.
The title of the epic is misleading in my opinion, the way the story is layed out, this optimizations are only applied to:
cache_reject_uri option. Exclusion via user agent or query strings would still have no optimizationI think it's something to consider when we communicate this to our users, because even for us in the dev team, it's confusing
@Tabrisrp Thanks for the heads up. Do you have any suggestions?
I thought of this:
I guess we can include it as part of the description of the feature.
This feature has been removed from 3.7.
As it seems to require more discussion to get something done right, we will take the time to debate about it.
@GeekPress Can you please confirm the topics that needs discussion related to this? What decisions needs to be made?
a similar request from the customer: https://secure.helpscout.net/conversation/1432788151/241369?folderId=3864740
Most helpful comment
@GeekPress For me personally, nothing should be applied for logged-in users, unless they have enabled User Cache.
I think the lack of minify/combine here will disappoint customers. I agree we don't want to add those features if they make the pages slower. In the future it would be great to optimize those features to make it possible.