so do you also have “lazyload images” active in Autoptimize? does the problem go away with that option un-checked?
I have lazyload images turned off
seems the “zoom” effect relies on the image being loaded at a higher resolution, which is exactly what image optimization tries to prevent from happening, so you will likely have to exclude those images from being optimized fifteenwheat. you can do so with below code snippet;
add_filter('autoptimize_filter_imgopt_noptimize','imgopt_excl');
function imgopt_excl() {
return 'zoomImg';
}
Thank you!
Where should I put this code snippet? I tried to put it in my theme’s functions.php, header.php, index.php, my custom-codes.php, and also into autoptimize’s index.php, also i tried it in my wp-config.php, and wp-settings.php, but none of them fixed the issue. After adding the code, i always deleted my cache, and did a full reload in my browser before, and after deleting the cache.
The easiest & safest solution is using the code snippets plugin. And when done make sure to clear (all) your page cache(s).
I added it via the code snippets plugin, cleared the cache (with the button on top of admin bar, and also saved the settings (i changed nothing) with clearing all the cache), but it still doesn’t work π
OK, but that’s Autoptimize cache, I assume you also have page caching (plugin or at hosting), did you clear that cache as well?
I have no page caching enabled. I am going to install a plugin, but wanted to resolve this problem first, so it won’t interfere.
OK, can you try below code snippet instead?
add_filter('autoptimize_filter_imgopt_noptimize','imgopt_excl');
function imgopt_excl() {
return 'wp-post-image';
}
I tried added it alone, added it in combination with the one mentioned earlier, deleted Autoptimize’s cache (both times), reloaded the page, but it still did not work π
how/ where did you add the code-snippet fifteenwheat ?
I added it via the Code Snippets plugin. Created a new snippet, set it to run everywhere, pasted the code, clicked save and activate. After that i deleted Autoptimize’s cache, and reloaded the page with the error.
errr … and with below snippet?
add_filter('autoptimize_filter_imgopt_noptimize','imgopt_excl');
function imgopt_excl() {
return '2018/07/IMG_8856-1-1';
}
This fixed the problem, but sadly only on that specific page, as far as i can tell :/
With other products, the problem still exits. For example here
I can confirm the exclusions currently only work on filename basis (had to check the code to confirm). I’ll add excluding based on the entire img-tag (so including attribute names/ values) to my todo-list and keep you posted.
In the mean time I can provide you with a code snippet to stop image optimization on /termek/*
if you want?