Has_post_thumbnail() fix for non existing files Blog

Having problems with missing files/attachments?

When callingĀ has_post_thumbnail() WP will return TRUE if a meta value is set, but this function does NOT check the fysical presence/availability of the attachment file.

To avoid this, swap the function call for the following code:

wp_get_attachment_url((get_post_thumbnail_id()))

this will return the string path of the file OR nothing.


Suggestie? Vraag of opmerking? Laat het ons weten!

Plaats hier je bericht

Reacties (0)