Website loading slowly - Advanced Custom Fields images
-
03-11-2019 - |
Question
I'm currently using get_field
with Advanced Custom Fields plugin (see here) to get a single image for search results. The end result is that these pages are loading slow, as I believe this is due to MySQL returning the whole array of all images in the gallery for the specified page, which ends up being huge.
To load the image, I am currently doing the following:
$image = get_field('house_photos');
if ($image) {
echo '<img src="' . $image[0]['sizes']['house_search'] . '" />';
}
Is there a more efficient way just to get this single image without requesting the entire array?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange