If you only want to work with yyyy-mm-dd
strings, for example '2014-10-10'
, you could do something like:
'before' => '2014-10-10 + 1 day - 1 second',
'before' => '2014-10-10 + 86399 seconds',
'before' => 'tomorrow 2014-10-10 - 1 second',
'before' => '2014-10-10 tomorrow - 1 second',
or
just append
'23:59:59'
to youryyyy-mm-dd
string
to get
'before' => '2014-10-10 23:59:59'
Related Posts:
- WordPress Custom Query to show posts from last x years
- Use meta_query to display events by date in custom field
- WP_Query orderby date not working
- Get Recent Posts by Date in Multisite
- Using WP_Query To Get Posts Randomly From today
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- datetime picker, timestamps and meta queries
- How to get the posts published in last two days using WP_Query?
- List taxonomy terms plus their latest post ordered by post date
- How can I hide posts that are over 2 years old
- Custom Field sort not working (WP 3.8.1)
- Ordering by meta_value AND date NOT WORKING with wp_query
- Query by custom dates in UNIX Time
- How to show recent and upcoming birthdays using meta_query
- Meta Query for specific months
- WP_Query meta_query >= date
- Complex date range with WP_Query and BETWEEN
- Comparing dates in custom field
- How to display upcoming events by dat with Modern Events Calendar Lite
- Orderby ASC changes to DESC in WP_Query
- Complex WP_Query order request: DESC by day, but then ASC by time
- How can I show many posts an author has per week?
- How can I create ‘future’ and ‘past’ parameter for restAPI by filtering the CPT custom date field by greater than / less than current datetime?
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- Taxonomy and Date in same query?
- 2 weeks ago from meta query meta value
- Shortcode for latest -not expired- posts
- date_query seems to be ignored by wp_query
- Posts published last 10 minutes
- WP Group posts by year(desc) > month(desc) > date(asc)
- Display Current Post’s Position in Custom Taxonomy
- WordPress Custom Search Form Displaying Unexpected Results
- Filtering posts by archive showing all years
- Query posts using less than
- WP Query and date format
- Ordering posts by custom field and grouped by month
- Limit loop to future events
- How to show list of posts with custom field value (a date) that are coming soon
- Show single posts date, in a page of posts
- Added Date Filter To Popular Posts Query
- Display upcoming events in the next 30 days by querying posts with timestamp in custom meta
- query hook parse_tax_query function takes no effect
- Comparing Meta Field date in WPQuery using Meta_Query?
- How to get only present and past posts with post_date
- WP Query for all events prior to current date
- Problem with my loops
- Sort posts on custom field AND after that sort on date?
- datetime picker, timestamps and meta queries
- Get posts by birthday
- Display Year and Month from custom field + Age Calculator
- Using WP_Query to re-query and sort results using a date?
- Year based WP Query
- WP_Query Sorting Posts by month … timeline effect
- Get post closest to today
- Query custom post type by date field only working when two posts match the query
- Get posts from similar time as current post
- Divide WP_Query posts by date & post type
- Query Posts by date range with fixed beginning and end
- Issue with sorting by post date and custom post type
- Get posts that were most recently tagged
- WP_Query sort by ACF date field (newest first) with blank dates first
- WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)
- How to display only posts from the last day with posts published?
- WP_Query filtering in ACF field containing dates
- 2 Loops on one page – pagination of 2nd loop ignore array of excluded posts
- WordPress: Cron locking and Queue
- wp_get_attachment_image not to get the post_thumbnaill
- Random posts in WP_Query when searching by tag
- How To Use WP_Query To Get The Custom Post type Posts With Keywords
- Empty ‘terms’ in ‘tax_query’ returns an empty array
- WP_Query with child element
- Custom Theme Building & Permalinks
- Include post_status check within $wpdb query
- Pagination returns 404 after page 20
- How to order by datediff in WP loop?
- Select posts wich has no relationship in custom taxonomy
- Query with two posttypes and two different meta_keys
- Custom query for tag and custom tag from 2 post type
- Sort by meta key within same day
- wpdb get_results() returns only 2 rows
- Duplicates When using Nested WP_Query
- meta_query not working with the_content()
- 3 wp_query on one page with pagination for last query
- Querying posts with meta key and meta value not returning anything
- Problems with WP_Query, Loop, a condition and Posts per Page
- WP_Query: Meta_Query with serialized value (or a workaround)
- how to exclude store in clipper theme wordpress code php
- Find by post_meta, then sort by post_meta, then sort by date (wp_posts)
- Query All Attachments and Order by Parent Publish Date
- How To Query All Attachment Images Found In Post Galleries
- Custom pagination (Title, date and teaser)
- WP_Query using meta_query with LIKE doesn’t return what it should
- Multiple tax_queries: display posts titles from several custom taxonomie
- Using custom field as ‘orderby’ value causing post grouping by publish date
- Using URL variables on a custom WP_Query
- Show recent posts from excluded category
- Website goes slow down after importing long database
- Sorting posts by meta values: 2 different orders
- Ordering Posts by parent category, name ascending
- Escaping WP_Query tax_query when term has special character(s)