EM_events::get() returns events with blank post_id
-
I am trying to implement some code to return some past events and display them in a page template for review before running a mass delete function.
The eventual plan is to do something similar to what is described here. I would like to schedule a function to remove past events either once an hour or once a day.
$monthago = date('Y-m-d', strtotime("-1 month")); $yesterday = date( 'Y-m-d' , strtotime("yesterday")); global $EM_Event; $past_events = EM_Events::get(array( 'scope'=> $monthago . ',' . $yesterday, 'limit'=> 100 )); ?> <pre> <?php echo count($past_events) . " events" . "\n"; ?> <?php echo print_r($past_events, true); ?> </pre>
When I load the page with this code, it returns an array of past events, some of which have an empty ‘post_id’
When I look up the event in the database by event_id, I can see that the post in fact has a post_id.
Further, when I modify the args passed to EM_events::get() to include the ‘post_id’ it returns the correct event, but the ‘post_id’ is still blank.
I’ve tried this on both php versions 5.4 and 5.6 with the same results on the same server.
Is there something I’m missing?
Thanks,
Randy
- The topic ‘EM_events::get() returns events with blank post_id’ is closed to new replies.