If we define the conditions:
A: my_custom_field_ignore EXISTS
B: my_custom_field_ignore = 1
then NOT ( A && B ) is equivalent to:
NOT ( A ) || NOT ( B )
meaning in our case:
( my_custom_field_ignore NOT EXISTS ) || ( my_custom_field_ignore != 1 )
We could therefore try the following for WP 3.5+ (untested):
$args = array(
'post_type' => $post_type,
'offset' => $offset,
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'my_custom_field_ignore',
'value' => '1',
'compare' => '!=',
),
array(
'key' => 'my_custom_field_ignore',
'compare' => 'NOT EXISTS',
'value' => '1', #<-- just some value as a pre 3.9 bugfix (Codex)
),
)
);
Related Posts:
- Meta query with string starting like pattern
- Getting attachments by meta value
- querying with custom meta field with meta_query
- Order by meta_value_num DESC and meta_value ASC on WP 4.0
- WordPress altering my custom query, How to fix it?
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- Order by meta_key in custom post type doesn’t affect the query
- meta_key and meta_value not working together
- Order Posts by meta value AND published date
- How to make Meta Query case sensitive?
- Fetch Record based on meta key dates
- Meta_query with multiple keys and multiple values
- meta_query BETWEEN, but the range is stored in the custom field
- Extend product search with meta in WooCommerce
- how to make members list directory through wordpress post custom meta key.
- Large AND OR query timing out
- meta_value_num not ordering all items
- meta_compare not comparing whole integer
- Display posts with specific value first in query
- Get every post with value in meta key
- add_query_arg to compare and display events from a certain date
- Comparing 2 Decimal Numbers from custom fields and displaying posts
- meta_query weird behaviour, static int will work, but not user data
- Query multiple post types, but different order for each
- Order by the first array within a meta_query
- Query ACF relationship field – Comparator IN – Value array
- ACF: How to query for a given value count of an array like field? (e.g.: How many rows has a `flexible_content` field?)
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- How do i create a custom post query when the meta value is an array?
- WP Query – grouping posts by same meta key, adding together values from another key
- meta_query is overriding default search
- Trouble with serialized metadata
- Comparing Meta Field date in WPQuery using Meta_Query?
- Getting posts by custom field value
- Query against multiple locations within single custom post type post
- WP_Query, ACF field and array
- Order by Date Custom Field
- Query by meta value (add a dropdown of all values)
- Order Posts By Custom Field That is an array of objects
- Custom WP_query and integrating into theme file
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Compare meta key separation
- query post based on comparison
- Get posts by meta value except one post [closed]
- How to get products with the same custom attribute like ean code
- Display products from specific category in shop page
- Meta Query with AND & OR?
- meta_query where value is equal to given value
- Query by meta_key and order by meta_value_num return orderby date
- Wp_query order by multiple custom fields?
- Comparing timestamps in meta query doesn’t work
- How to create/modfiy WP_Query to search in post title OR custom field?
- Filtering posts by custom field value not working
- Multiple meta queries but arrange by specific meta value order
- What format does the meta_query TIME type require?
- wp_query add arguments using array_push if variable met
- pre_get_posts order by not working
- Group WP_Query by meta_key date
- WP_Query filter and order by meta ordering by wrong joined table
- WP_Query last five posts, simply ordered by meta_value
- How To Fix WP Query Returns Results But Shouldn’t?
- What is the random string I am seeing when I use get_query_var?
- Orderby is working with one query but not with other
- meta_query in WP_Query value is not accepting array
- Adding multiple meta_key fields as orderby options to a WP Query via a function
- Changing sort order for presentation by Jetpack infinite scroll
- Meta Queries – should nesting work after WP 4.1?
- Filter and Order by Multiple Custom Meta Values
- Meta Query relation “AND” then set array accordingly
- 2 weeks ago from meta query meta value
- How to provide meta_key array to wp_query?
- How to set up hierarchical relationships without using plugins / meta query
- Meta query compare for ID’s greater than specific ID
- Is it possible to add relation between meta_query and tax_query?
- Order WP_Query results by meta key value in custom query
- Show single posts date, in a page of posts
- WP_Query Class custom field parameters
- 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
- How to add a “base” filter for all posts visible to visitors on the site?
- meta_query with meta values as serialize arrays
- Multiple WP_Query args combinations according to post type
- WP_Query multiple value not working
- WP_User_Query Orderby Not Working
- Unusual high query of user meta data
- WordPress Query optimaization for slow query
- How to create URL parameters to run custom queries?
- WP Query Meta Query
- How can I modify standard search query to include also ACF custom fields values?
- Best way to Order Post in Home without a plugin
- WP_Query using meta_query with LIKE doesn’t return what it should
- Loop through multiple custom fields with increasing number
- Return a single custom post from multiple meta queries
- new WP_query using custom fields
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- 294 Queries on Mainpage of WordPress
- WP Query – Show custom posts only if user contain some user meta
- How do I subquery with custom meta fields?
- How to include custom fields in wordpress search
- Extend search query to search meta keys values based on search string