Support » Plugins » get_posts only posts that have thumbnail (has_post_thumbnail)

  • Resolved marcusds

    (@marcus1060)


    I want to use get_posts (since I read I should use it rather than adding another loop) to select a number of posts (let’s say three) and only posts that have a thumbnail image.
    How can I do this? Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • I figured it out myself, so I’m posting this here incase anyone else every needs it.

    $postslist = get_posts('meta_key=_thumbnail_id&meta_compare=>=&meta_value=1');

    That seemed to always give me the correct result, if someone has a better way of doing so, let me here it.

    @marcus1060 you are the man!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_posts only posts that have thumbnail (has_post_thumbnail)’ is closed to new replies.