my client want me to add a custom fields for thumbail, so the logic will be

if custom_thumnail is empty, render the origina. But i don't like idea of writing if statments everywhere + am using SEO plugins for open graph and images, so now i have to use filters to implement the custom thumbail.

i was thinking of wp filters but i didn't find one for get_the_post_thumbnail.

//my if statments

1 Answer 1


You can use the post_thumbnail_html filter. This filter is applied in the return of the get_the_post_thumbnail function.

apply_filters( 'post_thumbnail_html', $html, $post->ID, $post_thumbnail_id, $size, $attr );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.