AO does not have logic to decide what images to preload itself; there are only preloads as set on the “extra” tab (not new) and image preloads on a per post/ page level (in the page/ post edit screen in the Autoptimize “meta box”).
If both options (extra preloads & image preloads in the metabox settings) are not used, then we’re in unknown territory (which I’ll be happy to try to identify but we’ll need to do some digging in that case)?
frank
Thread Starter
mattce
(@mattce)
Hi,
we’re using the lazy load feature from the “images” tab, that’s right. So the filter_lazyload_images filter is adding every image into a preload tag, that is using lazy load? If we’re using “1” (“lazyload all”), it’s adding every image from the whole page inside these tags? In our case, we’re ending up with about 300-400 tags, which is massively blowing up our html code and therefore has negative impact on the performance.
Could you add a filter (or an option) to seperate these functions, so that one can disable it, if not needed/wanted?
Just having lazyload on does not add preload images (just tested on my own site to confirm that this does not happen), but do you have anything in the Autoptimize “metabox” on edit-screen of the page (or post) where this is happening?
Hi, i have the same issue. It’s creating preload tag for every image on the page. But its just doing it on cached version of page
https://prnt.sc/1tQdadr2_n2I
“cached version of page” -> cached by what selcukkrd ?
im using spinupwp on hosting my site. They are using this plugin for cache control.
https://wordpress.org/plugins/spinupwp/
Web server is nginx and if im not wrong fast-cgi is used for page caching.
https://spinupwp.com/doc/caching-in-spinupwp/
-
This reply was modified 3 years, 1 month ago by
selcukkrd.
can you list theme + plugins used ? my guess is you all have something common (apart from Autoptimize) which somehow conflicts/ causes this?
Thread Starter
mattce
(@mattce)
Plugins in use:
Advanced Custom Fields PRO
Classic Editor
Classic Widgets
Contextual Related Posts
Custom Post Type UI
Custom Sidebars
Disable Feeds
Edit Author Slug
Loco Translate
WP-PageNavi
Yoast SEO
Our site is a multisite, the AO settings are all handled inside the network page, individual settings per site are turned “off”. Same for the meta box inside the pages/posts, “Enable configuration per post” is checked off.
Images settings (inside its own tab) are:
Optimize Images [] (off)
Lazy-Load Images [x]
Lazy-Load Exclusions: “loaded” (so one class only)
Lazy-load from nth image: “1” (all)
All further settings can be found here:
View post on imgur.com
One customization, we’ve enabled this filter:
add_filter('autoptimize_separate_blog_caches','__return_false');
via a mu-plugin
The problem only occurs for logged-out users (see second last checkbox, which is checked off)
-
This reply was modified 3 years, 1 month ago by
mattce.
OK, I just added some extra checks in the Beta version which _could_ help avoid those mystery preloads.
Can you;
- download the zipfile from https://github.com/futtta/autoptimize/archive/refs/heads/beta.zip
- go to plugins -> new -> upload and upload the zip-file from (1)
- disable Autoptimize 3.0.2
- enable Autoptimize 3.0.3-beta-0
- test again
If that does not work I’ll have to add some debug output to the PHP errorlog to help me *really* understand what is going on here ..
frank
Thread Starter
mattce
(@mattce)
Thanks for the beta version, unfortunately, it didn’t fix the issue.
I can’t give you access to this project (belongs to a client), but if any logs would help to get behind it, I can surely send them over
for your client I would rather suggest to use the new filter I snuck in there;
add_filter( 'autoptimize_filter_imgopt_dopreloads', '__return_false' );
for testing purposes it would be best if we could reproduce on a non-customer/ non-production site where it would be OK for things to go horribly wrong (they should not, but who knows what happens if I go up against that gremlin)? 😉
OK, think I found it, can you re-download the beta and test again?
Thread Starter
mattce
(@mattce)
Yes, I can confirm, the preload tags have gone, problem seems to be fixed with the latest beta update. Thanks a lot for your effort!
that’s a relief, the fix will be in the upcoming AO 3.0.3, likely this Friday (but maybe tomorrow Thursday already). thanks for testing/ baring with Matt et all!