I think this might be part of the problem in your past query (the second one)
array(
'key' => 'end_date',
'compare' => 'BETWEEN',
'type' => 'NUMERIC',
'value' => array($past, $now),
),
You’re using BETWEEN
but I think something like <
would be what you want. You don’t want to show events that have ended between $past
and $now
, right? You want to show events that have ended in general.
array(
'key' => 'end_date',
'compare' => '<',
'type' => 'NUMERIC',
'value' => $now,
),
Related Posts:
- Comparing timestamps in meta query doesn’t work
- Display two post types ordered by two custom fields
- Custom Query: If One Post Object Field Value Is The Same As Another
- Meta query and compare “!=” not working as expected
- Get Posts ordered by a date custom meta field
- Using meta_query, how can i filter by a custom field and order by another one?
- meta_query for keys that aren’t yet set
- WP_Query orderby custom field then post_date in one query
- Query custom post type by custom field
- Filtering a WP_Query meta_query by numeric values isn’t working
- Querying custom post type with 2 custom fields (date-range)
- Custom Queries: Joining On Meta Values From Two Custom Post Types
- How Can I save multiple records in same meta key?
- order by meta_value serialized array
- WP insert post PHP function dynamically generated Custom Fields
- How loop through posts based on custom fields
- Having trouble with custom date field for CPT query (WordPress)
- Display custom post types with custom date field value (before today) & order by custom date field
- Sort posts based on multiple custom fields
- Conditional to modify query results
- Filtering by Post Meta Custom Fields – Performance
- Ignore sticky posts if post is not in meta query
- query posts and custom post type with meta key
- meta_query compare >= not working but
- WP_Query: include custom post type only with specific meta value
- Returning a list of custom post types excluding those without a specific meta_value
- Two near-identical custom field types – one works, the other doesn’t . What can cause this?
- wp_query check if integer exists in custom field’s array
- Filtering custom post type on a combination of custom taxonomies and custom fields?
- Meta query for custom post type ignored in main query
- Querying Two Custom Post Types with OR Not Working
- Meta Query Not Returning Output Despite Having Matching Values
- Meta Query Filtering not working on Custom Meta Box using Radio Buttons
- First custom field value (out of several) displayed twice after query
- Meta Query posts not showing on ending date of custom field
- Admin Custom Meta Box – Pull Last 5 Posts from Custom Post Type
- How to Output which matched meta_keys were found from custom_type_posts?
- Possible to filter custom post type with multiple meta data?
- filter search custom field query
- How to let users choose where to search for posts?
- Query based on custom fields start and end date
- Getting a custom post’s custom field based on another custom post’s custom field select
- 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
- Filtering custom posts by custom fields (ACF) [closed]
- order the meta query results by 2 custom fields
- WP Query from two Custom Post type fields as statement
- Unable to gather Image URL from Custom Post Type’s; Custom Meta Field
- Orderby if between two meta fields
- Show posts from WP Custom Post Type selected from a field in a metabox
- How do I query with multiple custom fields orderby in same column?
- meta query multiple values for the same key
- Sort custom post archives by a meta value from a different custom post type?
- Custom post types – meta_query: search lesson which starts sooner
- post type => ‘any’ not applied my custom queries
- Meta_Query refuses to return results
- Sort loop by custom field from different post type
- Meta_query by date for Events archive
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Query events post type after current date and timezone
- Show first posts with custom field not empty and order all by title
- Conditional posts in WP_query for search
- meta query always fails even if data is correct
- Selecting posts older than the current Unix epoch timestamp
- Unable to get the upcoming events for custom post
- Filter CPT based on meta box value using Flexible Posts widget?
- WP_Query arguments: Loop through custom post type – get all entries except excluded meta_key?
- loop through custom post-type with two meta_keys
- Querying meta values within an array
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- Filter Custom post type by another Custom post type
- Check for custom field value in different post type than current one and do something
- Function to Compare CPT Post Custom Value with Default Posts CF Value
- How can I change the admin search posts fields?
- Random post, once per day
- How to select one major category (or custom taxonomy) for a custom post type?
- Display posts if a custom field value is equal to another custom field value
- Custom Fields vs Separate Table
- Show Two custom Post type and their posts on category page
- Using several custom fields as custom post title
- Calculate all custom field values in the post loop
- Role scoping for contributors down to the field level
- Having unique constraints for custom fields in a custom post type
- List of users that clicked a ‘Join’ button at single post
- search custom post type by custom fields on front end
- How to copy a custom field from the user’s CPT to the user’s normal posts
- Problem On Retrieving Post Meta Data on Custom Column [closed]
- Need help with simple “if statement” checks to output particlular CPT data depending on what client uploads/fills out
- Is there a (preferable built-in) way to check what custom queries are used in a theme?
- Check that a slug is present in the get_terms request
- How to display custom field in product description?
- Add custom template ‘sub-page’ to Custom Post type?
- How to get the posts that my following users are liked?
- pagination for a custom query
- one get_posts to return a number of custom posts for each meta value
- Get result from Custom Field in Custom Post type
- How to get lowest price from custom fields of posts
- Post object GUID adding http:/
- Meta_query question