I believe that a relatively simple meta_query would do it.
$args = array(
'post_type' => 'post',
'meta_query' => array(
array(
'key' => '_gallery_image_ids',
'value' => '',
'compare' => 'EXISTS'
)
)
);
$query = new WP_Query( $args );
Reference:
http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
Related Posts:
- Display images with same specific value?
- Is it possible to query all posts that don’t have an attachment?
- How to paginate wordpress [gallery] shortcode?
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- Count the number of images uploded on the website
- How to paginate attachments in a secondary query as gallery?
- How do I exclude all images from a wp_query?
- Get attachment by slug
- get images attached to post
- How to display images in related posts?
- post thumb nail
- query attachments of parent page if attachments of current page are smaller than …
- wp_query for displaying attachments with a tag
- WP Query search for attachments and their exact title
- Gallery shortcode numerical sorting
- Better wordpress attachment query than this
- How to add WordPress featured image via SQL
- Display all attached image of every post of custom post type and link to original post
- Insert images into wordpress post with a query
- WP_Query: attachment image in “full” size?
- Change database image location for transportability
- WP query retrieve the src of attached image
- Trying to use “Medium” featured image for custom post type on home page
- wp_get_attachment_image not to get the post_thumbnaill
- How To Query All Attachment Images Found In Post Galleries
- Some images not being returned with wp_get_attachment_image
- Pull Instagram images into an existing loop?
- Wp get all the sub pages of the parent using wp query
- What is appropriate flow for custom data from URL in WP_Query?
- How to merge two queries together
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- WP_Query orderby one custom field then another in one query
- WP_Query to show post from a category OR custom field
- Is it possible to select against a post’s parent’s fields with WP_Query?
- Get posts by meta data OR title
- Pagination causes error 404 when used with front-page.php
- How to pass custom parameter to WP_Query for filtering in pre_get_posts
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- Add custom search results to main WP search [duplicate]
- What is the difference between RELATION “AND” and “OR” in TAX_QUERY?
- Query Set Order By Author
- SQL Query inside Widget
- Use ‘parse_query’ filter to show posts that from multiple criteria
- How can I pick a single post from the latest 3?
- how to link to detail page(single.php?) in a wp_loop
- WP_User_Query unable to retreive all user at once
- Complex WP SQL Query
- Hide Administrators From User List except current user (administrator)
- Custom Query num_rows returns wrong amount
- How to figure out redirection and contents in hybrid solution containing word press content and legacy code (ASP.net)
- Category applied to pages, creates multiple breadcrumb entries after a search query (On the translated site)
- Most commented post showing 2 records
- How to store and receive variables in WP sessions?
- WP_Query Attachment adds additional attachment count and need to link attachment to post url
- posts_per_page option limits the number of Gallery items
- Does the WP_Query ‘private’ argument for post status only apply to privately published content?
- Query most popular terms by taxonomy over 2 week period
- Is there a better way to pull in custom content without querying posts?
- WordPress | Date not always appear [duplicate]
- WordPress posts for multiple years
- Filter posts by comparing custom meta value against postdate
- Query posts that contain video?
- Multiple Rows in a using wp_query
- “paged” in WP_Query returns 0 posts
- How to show one post different from the rest?
- Reduce number of SQL queries inside WP_Query loop to fetch author data
- Count posts per taxonomy else change taxonomy if less than x number
- Running multiple WP_Query
- Check if searched number is within the post meta value
- How to split a post and intercalate elements from a loop
- How to echo woocommerce category name
- Image Galleries for website migrated from .com to .org
- How can I update post meta inside a WP_Query loop or the WordPress loop?
- Printing a variable inside a custom WP_Query
- Notice thrown when creating numeric pagination on custom query
- Creating attachments archive in tags and categories
- Search.php – return number of results but cannot loop through
- Creating ‘posts page’ loop based on the page itself
- Use full size images in a specific gallery
- How to get pages of parent (non-recursive)?
- Combine query in WP_User_Query()
- How to get_comments() ordered by date and parent?
- WPQuery loop not giving expected output
- WP Query filters active on wrong query
- Not able to fetch woocommerce variation sales products for particular category products
- Global page ID variable empty error
- WordPress tax_query ignoring relation OR
- pagination functions are not working
- Gather same custom field values in one value in a select tag with wp_query
- Order Posts By Youtube Views
- WP Query with sticky posts and tax_query
- Declare inline background image in functions.php
- Looking for a way to exclude frontpage and nav menu from query filter
- Query posts by custom fields
- WP Query Obj: Set value to be unequal | Hide media by admin
- How can I add a single image from a gallery into the page header?
- I want to place a post before all others from an ACF boleen field
- How to put posts with some taxonomy on top of others in `pre_get_posts`
- WP-Query and Searching Inside Arrays
- Custom WP Query with neither ASC or DESC