You can always use a BETWEEN comparison in your query, I have used this, maybe you can adapt it to work in your situation. It avoids doing multiple checks for no reason 🙂
$first_date = 110501;
$second_date = 170514;
$meta_query = array(
'key' => '_exm_date',
'value' => array($first_date, $second_date ),
'type' => 'DATE',
'compare' => 'BETWEEN'
);
Related Posts:
- Exclude category on blog list page
- How do I display main query posts in random order using add_filter
- How do i search post by jquery datepicker?
- How to get post creation date?
- Changing the post date and time with function
- Removing filter dropdown in posts table (in this case Yoast SEO)
- Get old values for post before saving new ones
- Is it possible to Schedule Attachments in WordPress?
- How does filter the_posts work?
- How to publish a post with empty title and empty content?
- How to add a “publish” link to the quick actions
- WordPress Number of Posts Not Changing With posts_per_page
- Why is wordpress removing some unicode characters (e.g. some emojis) when I save my post?
- featuring old articles without messing up with the archive
- How to display an icon when a new post is published and then remove it when a specific time past?
- Human Time Diff, change mins to minutes
- Display custom post types by date field
- Custom Order in WP Query
- Can wordpress differentiate between added and updated posts?
- Fetch posts from current week (Sunday to Saturday)
- How to set post expiration date and time and move the page to archive after expiration [closed]
- Getting post id from wp_insert_post_data function?
- Custom excerpt length filter doesn’t work
- How can i do something after head like adding a hook for after head but before post
- Amend wordpress password function
- Custom Post Templates
- How to filter posts that belong to a specific category only if that is the only category
- XML-RPC and post_date
- Automatically republish old posts
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Replace ‘published on date’ with ‘modified on date’ on Posts
- how to get posts ids inside pre_get_posts filter?
- Modify Image Source With The_Content Filter?
- How can I show many posts an author has per week?
- Change post order random through out the entire WordPress
- How to exclude latest x posts from a paginated query?
- use wpml_post_language_details function other plugin based on $post->ID [closed]
- Add filter by custom field to block of posts
- Posts will not display on page-mypage.php
- Default to ‘all’ view on the ‘edit-post’ screen for authors
- WordPress Sidebar menu for posts based on date – guidance needed
- How to allow visitors to filter posts by multiple taxonomies
- date issue with category post retrival
- How to get date of post when using wp_get_recent_posts()?
- Worpdress function for difference dates
- add to end of post in the loop with plugin
- Is it possible to filter the main loop to exclude posts from a specific category?
- Modify posts listing at back end
- Prevent posts with certain post_meta to be edited
- Hook for changing excerpt content when excerpt not set
- How to update all posts at once?
- Assigning Two Different Post Dates For Single Post
- Using system date format
- How include css class based on post ( in loop ) slug?
- Custom Post Limit for homepage only without plugin?
- Restrict displaying posts to the poster itself (in Back-end)
- Add “Posted on” to post date
- Auto update post title and slug when post status is changed
- Exists filter or action that change Add New Post link?
- Retrieving posts by their date and category
- Date is wrong on ‘all posts’ page
- Getting an extra post’s meta data?
- Plotting posts on a graph
- changing parent_id on post
- Trying to exclude custom posts based on date, while sorting by custom field
- Post date automatically +100 years into the future
- can’t modify post title using the_posts filter
- user_has_cap filter allows “edit_others_posts” but not is not allowing updating/publishing
- Using AJAX to filter posts without refreshing page
- Change Old WordPress Post Date Year
- Display/Filter post using if else statement
- Set a post expiration and delete a post when expirate
- Dropdown Select Post Filter
- Display Updated Date Instead of Published Date
- How do you update post date (year only) in a separate custom field?
- show only one category and filter by tag
- Prevent WordPress from putting around specific element
- filter buddypress users posts by user ‘xprofile’ custom fields
- Override wp_link_pages pagebreak with filter
- How do I change the post title’s link on the posts page?
- Printable Page with all Posts from Tag
- Compare date of user’s last posts
- Hide Admin posts & pages in Dashboard
- Extracting a TLD from the content and assign to custom field
- How to get the postID inside ‘content_save_pre’? Other hook?
- Filter question list on substring of metavalue
- Query post for today, if no post get the previous one
- Get results from the main wp_query
- Keep post format class with isotope filter
- Display metabox with date
- Custom filter on all post page (admin backend)
- How to use in_category?
- How to display a certain template element only for posts published within certain time range?
- the_time() cannot be placed correctly
- WP_query sort by custom meta_key “price”
- How to var dump urls for all posts
- Add custom PHP (no-SQL) filter to WP_query
- how show post date for specific post?
- Exclude posts by date – related post
- Filters do not work when there are multiple (one works)