Disable loading=”lazy” on images in first block

add_filter(
	'pre_render_block',
	function( $pre_render ) {
		global $cwp_block;
		if ( empty( $cwp_block ) ) {
			$cwp_block = 1;
		} else {
			$cwp_block++;
		}
		return $pre_render;
	}
);

add_filter(
	'wp_lazy_loading_enabled',
	function( $default ) {
		global $cwp_block;
		if ( 1 === $cwp_block ) {
			$default = false;
		}
		return $default;
	}
);
Bill Erickson

Bill Erickson is a freelance WordPress developer and a contributing developer to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.

Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk