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 posts published between a date and today?
- Apply the_title() filter in post & page title, but not in menu title
- How to Change Order of Posts in Admin?
- How to get post creation date?
- Update post counts (published, draft, unattached) in admin interface
- Changing the post date and time with function
- Removing any and all inline styles from the_content()
- 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?
- using wp_update_post on save_post
- How to publish a post with empty title and empty content?
- How to exclude latest x posts from a paginated query?
- How to add a “publish” link to the quick actions
- How to put last edited entry on top of the blog-post list?
- Query posts from current year
- 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?
- Update existing post dates to random dates
- featuring old articles without messing up with the archive
- how to display post content without post image?
- How to remove_filter that filters iframes in posts? [duplicate]
- Filter posts by author and category simultaneously
- Filter post before *editing*
- Filter/Remove HTML Elements on all posts and pages
- How to display an icon when a new post is published and then remove it when a specific time past?
- How to output comments number of a post per day?
- Human Time Diff, change mins to minutes
- Display custom post types by date field
- How can I display a specific user’s first published post?
- Replace Main Query With Custom Query
- how “manage_posts_custom_column” action hook relate to “manage_${post_type}_columns” filter hook?
- Custom Order in WP Query
- Can wordpress differentiate between added and updated posts?
- Fetch posts from current week (Sunday to Saturday)
- If specific user role then sticky post
- 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?
- the_posts filter been called multiple time
- Filter Posts By Tag
- Custom excerpt length filter doesn’t work
- How can i do something after head like adding a hook for after head but before post
- Only display posts after current date
- Amend wordpress password function
- Custom Post Templates
- How can I remove posts of a certain category from homepage after a specified time period?
- How to generate numbers indistinguishable for the IDs of the posts
- Modify WP_Post before processing
- Display post from specific date
- Get random posts between specific dates / of specific age
- 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?
- Filter Custom Post Type by Category with Ajax
- Ajax posts filter by date, comments, top views, top likes
- How to add Tags Filter in wordpress admin dashboard
- Replace ‘published on date’ with ‘modified on date’ on Posts
- Applying $posts_clauses filter to specific queries only
- how to get posts ids inside pre_get_posts filter?
- how to remove dash (-) post status from post title on posts listing page wordpress
- Admin Posts Table Column Fitlering is not working for Custom Post Type
- Get latest posts from WordPress site without header, menu and sidebar
- Modify Image Source With The_Content Filter?
- How can I show many posts an author has per week?
- If modified on same day, show only time
- What is the filter or hook to add admin controls to posts on the front end?
- 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]
- Update all comments time to random dates?
- How to hide html tags on revision comparison pages?
- Add filter by custom field to block of posts
- Blog page pagination is not working after using the offset argument
- Posts will not display on page-mypage.php
- Ajax post filters not working
- Default to ‘all’ view on the ‘edit-post’ screen for authors
- Display Meta Values in Custom Filter – Admin Custom Posts
- How to filter my search in post if contains a word in title, content or excerpt?
- More then one menu items are assigned with “current-menu-item” class
- Update post_content everytime a custom post is opened in backend
- Posts and Attachments with “Published” status in Search
- 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()?
- Trying to alter the post_content through the_post
- Worpdress function for difference dates
- add to end of post in the loop with plugin
- Add filter to the end of the post
- Get post content with all filters applied, knowing post id
- Adding bootstrap classes to video shortcodes
- Is it possible to filter the main loop to exclude posts from a specific category?
- Changing default WP-Site creation date
- query post limits
- post__in not working with pre_get_posts, but post__not_in does work