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
- How can I capture the right-click event in JavaScript?
- 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
- How to set a custom post type to have viewable future posts
- Scheduled events disappear from events queue
- Only Showing Upcoming Events
- How do I search events between two set dates inside WP?
- wp_schedule_event not working?
- Manipulate post category after time
- 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]
- Filtering more than one term in a taxonomy in WP
- Short code for Venues
- WP_Query meta_query results date by date
- What is the Javascript event for an item being added to the cart in Woocommerce?
- Custom Post Type Events Archive Grouped By Month
- Events Made Easy Plugin – Duplicate Title Tags
- Event-Driven Pattern vs MVC?
- Only show upcoming event or current events
- Display upcoming Events for next 7 Days
- What plugin should I use for booking events and receiving payments? [closed]
- 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
- How do I search events between two set dates inside WP?
- Trying to create a table/list of my EventBrite course listings [closed]
- How to reorder and display a feed to be chronological?
- Keyup events in tinymce editor not working
- Pass argument to event hook
- List of all entries of custom-post-type: Add year-parameter?
- Catching Gutenberg sidebar switch event
- 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
- shortcode – I need to throw a message or load a different page
- Event Archive by Month
- Calendar for irregular recurring events [closed]
- 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
- Plugin to display weekly schedule that can be edited via admin panel
- 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
- 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
- How do I add this OnClick event script to a custom button I’ve created?
- Primary navigation menu with timed items from custom post type
- iFrame onLoad in custom Gutenberg block
- Display only upcoming events / Show all events when archive year is selected
- connect users to Custom post types
- Query events post type after current date and timezone
- Multi hook deploiement
- How to display the past events in one of the category?
- Update event post meta each day automaticaly
- 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
- Identifying a Page Containing Shortcode at `init`
- How to use template field in the Event Organiser plugin widget
- WordPress & PHP sessions
- How to fire jQuery after $(window).on(‘load’)
- I am trying to implement some logic on real time order sync using scheduler
- How to compare Event period with Week period using get_posts(), meta_query, relation and compare
- Convert WordPress into Event and membership managment software [closed]
- how to block bots from crawling specific directories via .htaccess