When using the query as a transient variable as shown below (i.e. using get_transient), the query results are incorrect when compared to actually writing out the query. It does not honor the “upcoming” parameter.
Have you tested tribe_get_events with the transients API or am I doing something wrong? Is it possible that the plugin hasn’t fully initialized yet when admin_init is called?
thanks!
In functions.php in a function ( hooked into admin_init via add_action(‘admin_init’,’set_event_transients’; )
`$upcoming_events = tribe_get_events( array(
‘eventDisplay’ => ‘upcoming’,
‘posts_per_page’ => -1
));`
`if ( true === ( get_transient( ‘upcoming_events’ ) ) )
delete_transient( ‘upcoming_events’ );`
`set_transient( ‘upcoming_events’, $upcoming_events );`
In my template:
`$artist_events = $upcoming_events;`
`foreach ($artist_events as $post) :`