- This topic has 6 replies, 3 voices, and was last updated 3 years, 3 months ago by
David.
-
AuthorPosts
-
February 7, 2023 at 1:44 pm #2525102
Thomas
Looks like a few people are going through the same thing but I didn’t want to piggyback onto someone else’s thread with solutions that might be more site by site specific.
Like a lot of people, currently working on cwv’s and getting the lazy loading error which is impacting Largest Contentful Paint. Caching plugin is telling me it’s theme/wp related.
Any ideas how to fix?
Using Generate Press info theme with latest version of WP. Caching plugin is flying press.. having lazy loading turned on, but have offset the first 3 images above fold, and also have included my logo from exclude list.. issue seems to be the featured image.. link in private box below.
Thanks!
February 7, 2023 at 2:09 pm #2525120Ying
StaffCustomer SupportHi Thomas,
Can you try adding a CSS class
no-lazyto the GB image block which represents the feature image in your single post.The image block can be found at appearance > elements > post page hero.
Then add this PHP snippet, so the WP lazyload attribute will be removed from all the images with
no-lazyclass:add_filter( 'wp_get_attachment_image_attributes', 'remove_lazy_load_attribute', 10, 3 ); function remove_lazy_load_attribute( $attributes, $attachment, $size ) { if ( isset( $attributes['class'] ) && strpos( $attributes['class'], 'no-lazy' ) !== false ) { unset( $attributes['loading'] ); } return $attributes; }February 8, 2023 at 8:28 am #2526130Thomas
Thanks for the reply. Let me know if I did this correctly and then will re-rest. Add n0-lazy to the additional css classes under advanced? and then add php snippet to customize/additional css?
Thanks!
February 8, 2023 at 9:08 am #2526185David
StaffCustomer SupportHi there,
The PHP Snippet cannot go in the Customizer.
This doc explains how to add PHP:February 8, 2023 at 9:11 am #2526189Thomas
ok, thanks… I am going to try and run without lazy loading to see what that does to scores. Would prefer not adding another plugin if possible.
Not GPS fault, but since WP added LL to core its been nothing but a headache on scores.
Thanks again!
February 8, 2023 at 9:11 am #2526190Thomas
thanks!
February 8, 2023 at 9:20 am #2526201David
StaffCustomer SupportYou’re welcome
-
AuthorPosts
- You must be logged in to reply to this topic.