How can I retrieve the post thumbnail (featured image) as an array?
Using get_post_thumbnail() I noticed in the WP documentation that there is a third parameter from, which I understand, one would be able to set it to return the values as an array instead of a string, but I can’t figure out how.
The reason I want to return the image as an array is to exclude unnecessary attributes in the output such as ‘wp-post-image’ etc.
Problem solved:
$image = wp_get_attachment_image_src( get_post_thumbnail_id(), $size);
The solution is to use
wp_get_attachment_image_src
. As per the Codex:Although the return is said to be:
There is a fourth element that indicates if it is the full image (false) or an intermediate image (true):