-
ltamas
Hi!
I have an online newspaper frontpage with many posts loaded by many queries. It is based on Info starter site.
I get a mediocre Pagespeed score due to the fact that all the featured images from posts are added as
style="--background-image: url(https://...;"and it results in significant load delay.
How can I force WP to add the first X (any number) of these images for preload?
Any solutions are appreciated.
-
Alvind
Hi there,
Featured images added as background images via CSS cannot be preloaded because they’re not part of the DOM and therefore not accessible to preload directives.
If you replace those background images with standard Image blocks, we can use a snippet to preload them properly.
-
ltamas
That is what I was afraid of.
Do you know any plugins that are able to do this?
Because changing the design is not the preferred solution, what do you think about putting a hidden element on the top to pre-load the images?
-
I don’t know a plugin that does this, unfortunately!
But you can tweak the background images on the page, for example, choose medium size instead of full or large can help with performance.
-
ltamas
For reference later:
I tested LiteSpeed cache plugin and it did some improvements. -
Glad to hear that 🙂
- You must be logged in to reply to this topic.