The problem seems to be the comparison. WordPress compares the post meta using SQL, so you have to use its syntax.
Try setting:
<?php $today = date("Y-m-d H:i:s"); ?>
Which will return something like 2017-12-1 12:12:12
In your post meta make sure to use the same syntax. You can set dates in various formats, this is the SQL default.
I would suggest using Advanced Custom Fields, or setring your own metaboxes to avoid typos and future headaches.
Here is a snippet of code from a project I worked with that dealt with exactly that. The date field was set in the admin using ACF;
$today= date('Ymd'); // ACF formatting
$args = array (
'cat' => '3',
'meta_query' => array(
array(
'key' => 'event_date',
'compare' => '>=',
'value' => $today,
)
),
);
Related Posts:
- How to represent “event” in a UML Class Diagram?
- How to test wp_cron?
- Recommendation for a WordPress Calendar Plugin with Recurring Events? [closed]
- Post date vs. event date in WordPress
- Looking for a simple calendar/events plugin [closed]
- Create a custom event post
- Show events date instead of article date in default calendar widget
- how to set array of args for scheduled event?
- Events plugin for irregular / complex events [closed]
- How to get an event to fire using Google Tag Manager for the wordpress audio player?
- Event Organiser: Event list includes regular Posts & custom fields? [closed]
- Single Events as Sub-Page to Main Calendar Page
- Reverse order of events on homepage [closed]
- Update user meta after one hour
- Event booking form for wordpress
- Plugin: Events manager – Next and previous event
- Event Management plugin
- How to Create Events Calendar
- Group the events post in month+year format?
- how can create carousel for posts that will be published a month later?
- Add option in th event calendar
- Post Terms As Class Name For Full Calendar Events
- What’s the difference between event.stopPropagation and event.preventDefault?
- How to set a timer in mysql
- How to use pygame.KEYDOWN to execute something every time through a loop while the key is held down?
- Angular 2 Hover event
- onclick event pass
- id or value
- Why onbeforeunload event is not firing
- WordPress: schedule multiple action hooks of the same name and time
- How to run a function every 5 minutes?
- WP Cron Doesn’t Execute When Time Elapses
- WordPress Media Uploader events
- Scheduled events disappear from events queue
- Only Showing Upcoming Events
- wp_schedule_event not working?
- Manipulate post category after time
- All-in-One Event Calendar: Custom Query – Getting each event Instance [closed]
- Plugin for event management? [closed]
- Loading Custom Post Type Events into jQuery-based FullCalendar?
- Custom Post Type “Event”: chronological list of recurring events
- The holy grail of Event Management Plugins? [closed]
- Is there a WordPress Event Manager that links with your user database?
- Archive by custom post type and custom date field
- Filtering more than one term in a taxonomy in WP
- Conference ticketing and seating module for WordPress [closed]
- Short code for Venues
- What is the Javascript event for an item being added to the cart in Woocommerce?
- Plugin allowing for artists, events and venues
- Why is wp-cron only executing on page visit?
- How to select events within current week using wp_query
- Plugin: Events Manager – Search by start date only
- How to display upcoming events by dat with Modern Events Calendar Lite
- Events Made Easy Plugin – Duplicate Title Tags
- Event-Driven Pattern vs MVC?
- Only show upcoming event or current events
- Calendar Solution: Handling upcoming Dates with Posts?
- Display upcoming Events for next 7 Days
- CPT EVENT – listing by month and filtering by category and month – form select option
- Calling plugin function inside custom plugin for onclick event
- Wp_schedule_event functions.php
- Redux callback action
- How do I search events between two set dates inside WP?
- Integrating Facebook calender to WordPress
- Select event where start date is smaller than current date and end date is greater than current date
- Trying to create a table/list of my EventBrite course listings [closed]
- List of all entries of custom-post-type: Add year-parameter?
- FYI: How to make Time.ly all-in-one event calendar mobile friendly [closed]
- How to add onclick event to widget image
- How to prevent the scheduling of the same event on the same day
- the ‘save_post’ event triggers when I want to start a new post
- Empty meta-box returns publishdate if no value is set?
- Event Archive by Month
- Calendar for irregular recurring events [closed]
- Creating an Events Feed with Sub Pages/Posts for Each Event
- Change status of page after an event (Looking for best practice advice)
- Yelp-style geographic directory plugin?
- How do I list the next 7 days and any events (cpt) contained in those days
- Custom Post Type ‘Event’: Chronological list of recurring events from meta_values in array
- The Events Calendar, wp_query returning event date not published date
- How to update ticket price programatically when adding to cart and checkout in woocommerce
- Is there a way to know when a page has been updated and do some action only once?
- How To Remove “All, Publish, Draft and Expired” in Events Dashboard
- Creating new page overwrites old page
- Events Manager: Create custom Placeholder for use in Email notification
- Primary navigation menu with timed items from custom post type
- Permalinks don’t update nor link properly
- iFrame onLoad in custom Gutenberg block
- Hourly events don’t get triggered
- Query events post type after current date and timezone
- How to display the past events in one of the category?
- DOM reference to TinyMCE editor element (button)
- Include custom table in query
- Loop posts in a table ordered by a custom field value
- Custom Loop Event Page
- Events with multiple event dates + permalink for each date
- Query Event Posts by Date
- Checking if field is set before comparing with meta_query in query_posts?
- WordPress & PHP sessions
- Unable to sort wp_query by date/time with multiple meta_key s
- Custom booking form field not saving