So the issue seemed to be with my second meta_query array – instead of checking if pub_date EXISTS, I decided to check if wpcf-date-time DOESNT EXIST:
$today = date( 'Y-m-d' );
$args = array(
'post_type' => array('research_article', 'events'),
'posts_per_page' => 10,
'post_status' => 'publish',
'orderby' => 'meta_value date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'wpcf-date_time',
'value' => $today,
'compare' => '>=',
'type' => 'DATE',
),
array(
'key' => 'wpcf-date_time',
'compare' => 'NOT EXISTS'
),
'relation' => 'OR',
)
);
Related Posts:
- Query custom post type by custom field
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- WP insert post PHP function dynamically generated Custom Fields
- Having trouble with custom date field for CPT query (WordPress)
- Sort posts based on multiple custom fields
- Conditional to modify query results
- query posts and custom post type with meta key
- First custom field value (out of several) displayed twice after query
- How to conditionally add Custom Post Type to Front Page
- Display a post from custom post type only if all the selected taxonomies and custom field value matches the record
- Custom Query: If One Post Object Field Value Is The Same As Another
- Filtering custom posts by custom fields (ACF) [closed]
- WP Query from two Custom Post type fields as statement
- Using OR relation in meta_query to check for a value before sorting by another
- Meta query and compare “!=” not working as expected
- How do I query with multiple custom fields orderby in same column?
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Show first posts with custom field not empty and order all by title
- Filter CPT based on meta box value using Flexible Posts widget?
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Filter Custom post type by another Custom post type
- Get Posts ordered by a date custom meta field
- Custom Post Type Data in Sidebar widgets?
- Hide custom post type field from author?
- Many to Many Relationship between Two Custom Post Types
- Sorting a query by custom field date
- Creating Photo Gallery System with Custom Post Type
- Set post title from two meta fields
- How to sort CPT by custom meta value (date), and return posts month by month
- Trying to save custom post type from frontend partially working
- Custom Taxonomy order by Custom Field
- Include both default and Custom Post Type in query modified inside pre_get_posts
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- Querying Term Posts in Loop
- Custom Post Type Navigation on Custom Field
- how to interconnect custom post types?
- WP All Import – Using Xpath to set a select value
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Am unable to reset a query properly
- search also in taxonomy, tags and custom fields
- Filter custom posts using auto populated dropdown selectors
- Custom setting to show or hide field
- Dynamic dropdown select values depending on other custom field value
- Grouping metadatas into one
- Custom fields (wp_post_meta) vs Custom Table for large amount of data
- How to Output which matched meta_keys were found from custom_type_posts?
- Integrate Custom Post Type Events into Calendar
- How to get a custom field value of a custom post?
- Query based on custom fields start and end date
- DIsplaying URL of custom field in last post of certain taxonomy && post type
- Multiple single templates?
- How to get a custom type post data when it has a connection with another custom type post?
- Query Custom Post Types with checkboxes
- List of child custom post types lists all custom post types
- Having Issue on Ordering CPT by Custom Field In Custom WP Query
- How do I replace the post title with a custom field?
- Custom Post type loop with ACF not displaying properly
- How to display wp_post by custom field value?
- How can I output WPAlchemy repeating fields meta values in my page template?
- Get A Custom Field From A Custom Taxonomy Of A Custom Post Type [closed]
- Custom post types category
- “Custom Field” to Excerpt field” for pages? [closed]
- Let users upload image(s) to the post from front end
- Custom Taxonomy dont save in a frontend form for post a custom post
- Update custom field value
- Query Custom Post by taxonomy multiple categories
- Insert custom fields to a custom post type
- A sports wordpress website
- How do I ensure that post_type and Taxonomy use the same slug?
- Custom taxonomy terms as children of multiple custom post types
- Custom Post Type meta data getting deleted on bulk editing taxonomies
- Custom Column in CPT admin table not updated after Quick Edit save
- How to access repeater field of a custom field?
- PHP Warning with Custom Fields
- Custom post types & Pages hierarchy – Error 404
- How can I group by Taxonomy on Custom Post Type while filtering out based on custom Meta
- filter rest api post by a acf filed
- How to prepend text to custom field value A, but only if custom field value B matches a certain string?
- Custom post type that lets users create a set of posts?
- Delete custom post type metadata without deleting the post in admin area
- Creating multiple CPT posts from one Gravity form
- Converting a checkbox filter for custom fields to a dropdown
- Function not pulling image or text from custom post type
- Order Custom Posts by Several Fields
- Repeatable custom meta select boxes
- Post content stays the same but permalink changes ?
- Pagination not working with custom loop
- 404 on Pages for Custom Post Type & Query_Posts
- Types plugin isn’t compatible with my custom post type
- custom post-type query just returns two posts
- Show Posts in Vertical Tabs with Scrollbar
- How do I filter a custom post type loop by a field?
- Custom Post type as Taxonomy
- Display div based on Group metabox selection [closed]
- Display ACF object field data using Elementor Custom Query
- Sortable admin columns ordering from custom fields isn’t combine com search and Dropdown filter
- WordPress custom field sorting, weird behavior: the latest post is at the end
- I want to understand plugin implementation of custom posts / taxonomies / metaboxes
- How to consume external API from WordPress post editor and display the response data in the custom field?