Query posts only with featured image

Posted by Prem Tiwari | Updated on

If you do not, the posts will still have a featured image set, but the attachment they refer to will be invalid, and any attempt to call the_post_thumbnail will fail. Using your code you would get just the post title, and no thumbnail. This would give the impression that posts that have no featured image are being pulled in. This is not the case, they have a featured image, it’s just not available because of the mistake you made when importing.

Delete your posts, and re-import using the correct settings.

Also to demonstrate the point, you made no attempt to actually check the posts, always check:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers