Thanks for @dunc and @helgatheviking I got the answer. Here’s my code. You need the post type declared, otherwise it resorts to “post”. I also couldn’t do this unless I put meta_key and meta_value in a ‘meta_query’ multidimensional array.
$args = array(
'post_type' => 'tsa_events',
'meta_query' => array(
array(
'key' => 'slideshow_image',
'value' => array(''),
'compare' => 'NOT IN'
)
)
);
EDIT: you can also structure your query this way:
$args = array(
'post_type' => 'tsa_events',
'meta_key' => 'slideshow_image',
'meta_value' => array(''),
'meta_compare' => 'NOT IN'
);
Related Posts:
- Upcoming Event: How do I sort database by custom date field, but ignore past dates?
- Display posts where date field matches current month?
- WP_Query – Order results by meta value
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Filter WP_Query for posts having a certain meta-value
- Can I query custom meta data through WP_Query
- Meta Query with AND & OR?
- How do I search an array stored in a custom-field using WP_Query?
- How do I order by multiple custom fields using wp_query?
- Group posts by custom field
- Trying to perform complex custom field query with order by set to field value
- Query meta field using between
- Order Posts by Closest Numeric Values
- 2 orderby in wp_query with 2 custom fields
- Order posts by custom field and if custom field is empty return remaining posts
- Can serialized arrays in DB be matched against serialized arrays with meta_query?
- How to get a meta value from all post
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- Compare meta_query decimals not working right
- Using new WP_Query in shortcode in a custom field causes the main post content to not display
- Calling Specific Pages with wp query Part II
- WP_Query multiple use of relation and/or
- Loop through two different sets of custom fields
- Query Problem – Show posts within category ‘x’ that have a custom field between ‘y’ and ‘z’
- Using OR in WP_Query negates the “NOT EXISTS” compare
- WP_query : meta_key with custom rule for specific value
- How can I combine meta_query queries?
- How to filter a dd/mm/yyyy date from a custom field in a query
- Using WP Query to search by multiple meta fields
- Difference between ‘LIKE’ and ‘IN’ in meta queries
- Compare WP Custom Field date
- Sort by posts that have a featured image?
- WP_Query display next custom post from today’s date
- Order by value in serialized custom field
- $wp_query meta_key naming issue [closed]
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- Meta_query and numeric comparison [closed]
- How do I exclude posts by custom field value?
- Echo values from custom field outside loop php
- wp_query to find posts by year and month
- Adding Custom Fields to Search
- Any way to include custom fields in WP_Query results?
- Calling custom fields for pages (not posts)
- Duplicate posts being displayed when querying Custom Fields
- Multiple relationships in a query
- Loop to display random posts only if a custom field matches category
- WP Query Returning All Posts
- How do I use wp_query for WordPress search?
- Meta query with timestamp using WP_query
- how do i remove posts from a WP_Query so the pagination is right?
- Conditional custom field query
- Order query by meta_value with multiple custom fields
- WP_Query orderby modified to include custom meta changes
- How can I show custom fields in the loop only to specific user roles?
- get_posts that match a user-specified value on a page
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- How to Filter Posts by Custom Fields?
- Accessing loop functions (e.g the_title or the_content) from post ID
- Auto Populate Custom Field with Complex Value That Increase by One?
- Limit the number of acf content when displaying in post loop [closed]
- Orderby is working with one query but not with other
- Get a list of posts with associated meta_value
- Order by empty custom field
- Is there a better way to list all database terms alphabetically?
- Change the main loop WordPress impact on the server?
- custom-meta-box checkboxes from loop won’t save
- How to show a post if was published less than two hours ago?
- List users by sum of all their posts’ custom field values
- Custom WP_Query for WordPress Search Results with meta_query
- Meta Query And/Or
- How to combine custom fields to make one order-able value
- Custom Fields – How to create a list from multi-line entries of a single value
- how to make nsfw post with thumbanil
- Custom Query based on custom field of a single post
- Efficiently sort only certain categories by custom field
- Can I access a post meta field before the loop?
- Passing meta_box string to post__in?
- Displaying page image in the footer automatically
- Query post by date (stored custom field meta as yyyymmdd) and differentiate across 12 months
- meta_value and meta_key filtering returning no posts [closed]
- Show image if author meta (profile fields) exists outside loop
- Select custom posts by meta_value and sort by a different meta value
- Adding custom field and querying from post table
- Conditional operator OR not working with custom fields
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- WP ForLoop to compare meta information of posts to determine what post to display
- ul list with only as many li’s as filled custom fields
- Query only displays one page_id
- Loop through incrementing custom fields
- do_shortcode close
- Search Results Page – Displaying Custom Meta Fields
- Meta query relation ‘OR’ not working as expected
- The best way to collision check in WP
- Interrogate a page within a loop to check template type or custom meta data (Pages vs Posts)
- WP_query multiple custom fields not working
- Collect Data from NEXT item while in loop
- Custom Query Fields – Altering Meta Value
- How to query for posts with either one or another custom field
- Multiple Custom Field Query
- How do I list a custom field and custom taxonomies for each result in a loop?