As documented, you can set the compare property of the meta query to NOT EXISTS:
$args['meta_query'] = array(
array(
'key' => 'instrument',
'compare' => 'NOT EXISTS',
),
);
Related Posts:
- meta_query with meta values as serialize arrays
- Use REGEXP in WP_Query meta_query key
- How to query posts based on lat-lng coordinate as post meta?
- Set Alias for meta_query arguments in get_posts()
- How to Compare Two Meta Fields
- Getting attachments by meta value
- Using custom meta_query with relation not working as expected
- WP_Query meta_query where meta value ends in space
- Nested query inside Logical operator OR not working in meta_query
- WP_Query not working as expected for attachments and custom meta_query
- How do I create my own nested meta_query using posts_where / posts_join?
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- How to order a post type with meta_value_num and if meta_value_num does not exist then order by date
- Exclude post on loop by multiple meta key value
- How to query ‘posts_per_page’ to display a different blog posts index template?
- Order By Multiple Meta Fields
- Advanced WP Query hogs the SQL server
- Order posts by meta value and Date
- Query sticky posts with thumbnails
- How to get user_id from wordpress database inside ajax function?
- Meta query with order by another custom field
- WP_Query with multiple meta fields filter?
- How to combine meta_query and post__in in WP_Query
- How to orderby meta_value_num with dollar ($) sign
- Order a query result by a numeric meta key even if it does not exist, but put the posts with meta key first
- Single meta_query query using OR instead of AND in request’s WHERE statement
- Meta Query Array Error 500
- SQL: What is wrong with the following query (generated by WordPress WP_Query, ordering prices)
- Why isn’t my `meta_query` array functioning properly?
- Overwrite YoastSEO meta-tags with another page’s [closed]
- How to orderby multiple meta fields if some fields are empty
- Fetch Record based on meta key dates
- Suggestions on making this query/code more performant
- Order by meta value (numeric value lower to higher)
- WP_Query with different postmeta filter for each categories
- meta_query not working as expected
- Slow WP_Query with ‘OR’ on meta_query
- meta_compare not comparing whole integer
- How to provide meta_key array to wp_query?
- meta queries do ‘either/or’ checks
- How to set up hierarchical relationships without using plugins / meta query
- WP Query ordering on a meta field for posts with a date in the future not ordering by datetime
- Selecting posts with a given meta value for a meta key
- Meta query compare for ID’s greater than specific ID
- Get every post with value in meta key
- get_page meta query not working, maybe a bug?
- Is it possible to add relation between meta_query and tax_query?
- Query by date from custom field
- Is it possible to retrieve posts depending on meta_key LIKE condition? [duplicate]
- Show single posts date, in a page of posts
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- WP_Query Class custom field parameters
- Sort posts using multiple custom fields and menu_order in single query?
- meta_query where the meta value is not the post title
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- Order (by ASC) posts with meta_key so posts without values are last
- Search filter between promo and exact price
- meta_query with meta values as serialize arrays
- Woocommerce Get Orders By Meta Value
- meta_query is overriding default search
- Multiple WP_Query args combinations according to post type
- WordPress Meta Query Null Values Order
- WP_Query multiple value not working
- show most viewed post
- WP_User_Query Orderby Not Working
- Why can my filter query SOME metadata but not other metadata?
- Getting posts by custom field value
- Unusual high query of user meta data
- WordPress Query optimaization for slow query
- wordpress multiple meta value query is not working
- Strange results from WP_Query
- Pre get posts sort by meta key returns no results if meta key does not exist
- meta_query with relation = AND not working as expected when combining EQUALS with NOT EQUALS
- WP Query for Multiple Post Types
- Meta query doesn’t remove placeholder escape before query
- Order Posts By Custom Field That is an array of objects
- WP Query Meta Query
- Orderby query does not work for custom fields even with meta query
- Query custom meta value – post view and date meta
- How can I modify standard search query to include also ACF custom fields values?
- make query more simplest and in one query
- Custom WP_query and integrating into theme file
- WP_Query – show posts where meta value and user_email match
- Best way to Order Post in Home without a plugin
- WP_Query using meta_query with LIKE doesn’t return what it should
- Use not custom fields in get_posts() meta_query?
- Compare meta key separation
- Return a single custom post from multiple meta queries
- query post based on comparison
- WordPress Query Default Order if Meta Values Same?
- Including ‘cat’ => $cat breaks meta_query
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- Wp query by 2 meta field – check if they exists / have value
- 294 Queries on Mainpage of WordPress
- WordPress extremely slow when using get_posts with multiple meta_query relations
- Use meta query only 3 or more results?
- Use value from meta key array for use in WP_Query
- WordPress – Optimize the Meta Query for 3 meta keys at a time
- WP_Query filtering in ACF field containing dates