Tribe_get_events malfunctioning when using transients API

Home Forums Calendar Products Events Calendar PRO Tribe_get_events malfunctioning when using transients API

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #19432
    Jesse
    Member

    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) :`

    #19456
    Jonah
    Participant

    Hey Jesse,

    I’m not sure if this has been implemented or not but would you please post your code somewhere else so we can read it? http://postie.org / http://pastebin.com / http://gist.github.com

    Thanks,
    Jonah

    #19487
    Jesse
    Member

    Here’s the code:
    https://gist.github.com/2765375

    thank you!

    #19514
    Jonah
    Participant

    Hey Jesse, not quite sure why your example is not working but I got transients to work this way: https://gist.github.com/2766720

    I went off of this example for reference: http://www.wpbeginner.com/wp-tutorials/speed-up-your-wordpress-by-caching-custom-queries-using-transients-api/

    So it appears to be working… Can you try refactoring your code based off of my example and let me know whether that works?

    Thanks,
    Jonah

    #976897
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Tribe_get_events malfunctioning when using transients API’ is closed to new replies.