Replace $today = date('Ymd')
with
$hour = 0;
$minute = 0;
$second = 0;
$month = (is_month()) ? get_the_date('m') : 1;
$day = (is_day()) ? get_the_date('d') : 1;
$year = get_the_date('Y');
$timestamp = mktime($hour, $minute, $second, $month, $day, $year);
$search_date = date('Ymd', $timestamp);
// echo $search_date;
In your query, replace 'value' => $today,
with
'value' => $search_date,
Related Posts:
- WP_Query meta_query results date by date
- How do I use WP_query with multiple post IDs?
- Best Practice for PHP
- Include WP_Query in my own PHP file?
- Inject post (from specific category) between posts in Loop
- is_page() not working from within a plugin
- Passing JSON data from WP Query into AJAX causing NULL errors
- AJAX / Read More: multiple check_ajax_referer() and wp_create_nonce() not working independentely
- Display certain amount of posts on taxonomy archive page
- Result of Custom WP_Query appears on 404 Page (but result are found!)
- Show only one post for each author ( Page loads too slow )
- How to add 2 posts under another post? Formatting should be intact
- what is diference wp_get_attachment_url / wp_get_attachment_src / get_post_thumbnail_id?
- Modern Tribe Calendar wp-query with meta query not working at all
- Count number of published posts by type
- How to display custom field on homepage
- WP_Query sort using multiple numeric meta values
- Can an array be used as a meta_query value?
- Can’t increase posts_per_page by variable
- WordPress WP_Query() Not working properly
- Get taxonomy terms only of the WP_Query current posts
- How to get to a specific position in wp_query?
- Get category name from custom loop and echo it once
- WP_Query loop, does not display special characters in title correctly
- Remove query string specific key value
- Hide post if matches current month and year
- Use WP_Query in shortcode
- Why is variable not working on custom sql query using wpdb?
- How to do multiple searches (with logical OR) in WP_Query in hook pre_get_posts?
- Random order of WP_Query results with highest meta value
- WordPress Scheduled Event Request Blocking
- get current custom post ID by WP_Query method
- How to securely provide a $_POST var in WP_Query with PHP 7?
- Create WP_Query to search for posts by their categories or their parent/child categories
- If Query In Sidebar
- Dynamic content based on a URL parameter
- Security for data obtained from the database
- How to get all author posts outside of author templates
- How to get post ID in a Page?
- How to retrieve the data from the sever and displaying it in a page?
- How to overwrite orderby with add_query_var
- How to Configure Events List in WordPress to Disappear Event Once Date is Past
- get_the_ID() in the footer returns wrong value
- How to override url params with rewrite rules vars?
- How to display SQL query that ran in WC_Order_Query?
- Store metakey value as an array
- Post not populating for custom post type based on category selection
- extract serialized array to use for wp-query
- WP_Query multiple post results
- Infinite Loop – WP_Query
- echo var into wp_query
- List of Events with Multiple Dates: Only NEXT Date
- Toolbar Hidden in a Virtual Page
- WordPress SQL JOIN query
- WP_Query and help with the loop for magazine front page
- Wp Query : Order by distance lat,lon
- How to WP_Query posts order by parent title?
- search.php to search only the post title
- WP_Query – How to query all of post types categories
- How to work Woocommerce pagination inside shortcode?
- get different meta-data of a complicated query at the same time
- Using a new WP_Query inside the loop
- wp_Query with mutuplea values returns all posts
- wp_query – Exclude the first thumbnail from lazy loading on archives
- WordPress sorting posts by date and title using a dropdown
- How to get specific multiple pages excerpts at homepage?
- Usermeta data unserialize, extract and display in table in WordPress
- Use WPQuery to match to specific repeater row in post
- WP_QUERY post_in problem
- how to get data from two different table from wordpress database
- Assign meta_query value to php variable
- How do I add this OnClick event script to a custom button I’ve created?
- WordPress search query, how to modify the sql
- Modify post image in full size
- Wp-query output correct, but the loop shows one less item (only sometimes)
- How to display sticky post always at the top (before regular post) in wordpress?
- wordpress query returning unexpected results
- Custom Post type Ajax search results
- Making list of posts with chosen description
- Ordering / grouping posts by datepicker ACF
- Include search tags and users in my search results system
- Transfer WordPress Login Session to an Extended Webpage on the Same Domain
- How can I display a query in a page?
- direct query to post_meta table
- Add post class in custom loop (WP_QUERY)
- List sibling pages widget, exclude current page
- Why does WP_Query show only the same post even with different categories and endwhile?
- show/hide attachments
- Custom query_posts() parameter
- WP_Query based on another query on the page
- Does wp_query and query_posts affect website performance? [duplicate]
- WordPress post pagination on custom template not working
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- How to modify this function to exclude also the post belonging to a specific category?
- Show post like this image in my newssite [closed]
- Display biography post for today’s birthday person
- Variable ++ in query loop
- AJAX WP_Query’s order and orderby parameters not working
- Add adjacent post function inside custom recent post function
- How do I exclude the current post from the upcoming post query