primary-header Image must not be lazy loaded

  • Author
    Posts
  • #163103

    sam68740
    Member

    Hi there,

    the first image in #primary-header is lazy loaded. This cause an issue with LCP metric.

    Is it possible to remove the lazy load for this one?

    The blog I need help with is samuelschmitt.com.

    #163110

    tarasdashkevych
    Theme Author

    Hello Samuel,

    By default, the theme does not include any functionality to lazy-load images because it’s against WordPress codding standards. However, WordPress.com provides such functionality.

    You can try this code snippet to avoid applying lazy load functionality to the image shown in the page header in singular views:

    
    function themesharbor_skip_lazy_load_primary_header( $classes ) {
    	if ( is_singular() ) {
    		$classes[] = 'th-featured-image';
    	}
    	
    	return $classes;
    }
    add_filter( 'jetpack_lazy_images_blocked_classes', 'themesharbor_skip_lazy_load_primary_header', 999, 1 );
    

    For custom code snippets on your WordPress site, you can use this free plugin: https://wordpress.org/plugins/code-snippets/

    Please let me know if you have any additional questions.

    Kind regards,
    Taras

The topic ‘primary-header Image must not be lazy loaded’ is closed to new replies.