Just use get_posts(), can I get all posts that has feature image?
-
Hi all
I am working on a function where I need to display a simple gallery that list all features images inside posts.
Since there are some posts which does not have feature images, I know that I can do something like this in pure SQL:
SELECT * FROM wp_posts AS p INNER JOIN wp_postmeta AS pm ON (p.ID = pm.post_id) WHERE pm.meta_key = 'img_url' AND IFNULL(pm.meta_value, '') != ''
But I wonder if I can make it much more simpler by using get_posts()?
Thank you in advance for your help.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Just use get_posts(), can I get all posts that has feature image?’ is closed to new replies.