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)
- WP_Comment_Query pagination, delving into the unknown
- Getting all user metadata from user
- Limit WP_Query to only X results (total, not per page)
- How to disable main query?
- Use post__in and post__not_in together?
- Compile two queries to one set of results?
- How can I order Wp_Query hierarchically?
- WP_Query ajax loader detect end of posts
- How to get count of posts assigned to given category?
- Wp redirect to url with ampersand string
- Change query based on post type while staying in loop
- Custom Pagination Layout for Elementor widget
- $WP_Query: How to display excerpt on first post only
- How to properly reset a nested WP_Query query
- How Can I Change The Tax Query For The Main Loop For Taxonomy Archives?
- Copyright: Get first and last date of post type
- how to write wordpress query for multiple metakeys checking?
- How to display a list of posts in same child category as current post
- querying posts with a custom status
- Display post meta conditionally based on it’s value
- How can i show pagenavi in my author.php?
- Randomly select one of last 3 posts
- Using WP_Query with multiple loops on one page in search.php
- Order by post meta not working with pre_get_posts filter
- is_user_logged_in not working from WP-API (wp-json)
- WordPress private post won’t display to other admins
- Only show tag with the same id as the post
- Sort by price wpdb
- Show a message if there are no active posts in category
- next_posts_link not visible on first page
- Filter posts/pages by user_role array
- WP_Query with meta_value_num and meta_query not paged correctly
- I need value of saved meta to display next to the post it is associated with
- Post Query not working after updating to 4.1
- Search Query that Includes Custom Table
- Pagination with WP_Query not working
- Can’t seem to get an else statement correct? [closed]
- I want to capture the last day’s (today) posts in a category in the numbered order in acf