CoreBoost v3.3.7
π Fixed - LCP Preload Not Firing When preload_method Is Not video_hero
Root Cause
preload_video_hero() β which reads _elementor_data from the database and emits a
<link rel="preload" fetchpriority="high"> at wp_head priority 1 β was only called when
preload_method was explicitly set to video_hero or video_fallback. Sites using any
other preload method (e.g. automatic, css_class) received no <head> preload for the
video fallback image, causing the LCP resource load delay to remain.
Additionally, inject_lcp_foreground_image() Levels 1β3 could all miss when Elementor
applies the fallback background as an inline style via JavaScript (client-side) rather than
server-side PHP β so no URL was ever found and cb-lcp-img was not injected.
Changes
preload_hero_images()(Hero_Optimizer): after the normalpreload_methoddispatch,
always callspreload_video_hero()whenenable_lcp_foreground_injectionis on. This
implements Method A from the Manus AI research: an unconditionalwp_headpriority-1 preload
tied to theenable_lcp_foreground_injectionfeature flag.output_preload_tag()deduplication
prevents a double tag ifvideo_herois also the activepreload_method.inject_lcp_foreground_image()β Level 4 added (Resource_Remover): when Levels 1β3 all
fail, reads_elementor_datapost meta directly and scans the first 5 top-level Elementor
elements forbackground_video_fallback.url(thenbackground_image.url). This is the same
database-level lookup used bypreload_video_hero()and is immune to whether Elementor applies
the inline style via PHP or JS. Result cached in closure scope β DB query runs at most once
per page even when multiplecb-lcpelements are present.
Files Modified
includes/public/class-hero-optimizer.phpβpreload_hero_images()secondary dispatchincludes/public/class-resource-remover.phpβinject_lcp_foreground_image()Level 4