Support » Plugin: The Events Calendar » tribe_get_events returns wrong data

  • I am currently using the plugin’s function tribe_get_events to get all the events in a specified venue:

    $events = tribe_get_events(array(
    	'eventDisplay'=>'list',
    	'posts_per_page' => 4,
    	'start_date' =>date('Y-m-d',current_time('timestamp')),
    	'featured'=> false,
    	'meta_key'=> '_EventVenueID',
    	'meta_value' => $venue_id, 	
    ));

    The issue is that it returns the ID of the venue in the EventStartDate field:
    ` [EventStartDate] => 109
    [EventEndDate] => 2019-09-30 17:00:00 `

    Looking at the query tribe_get_events produces, there is this line:
    MIN(wp_postmeta.meta_value) as EventStartDate

    Has anybody else encountered this issue? Is it a bug?

    • This topic was modified 2 years, 8 months ago by sergioes.
    • This topic was modified 2 years, 8 months ago by sergioes.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey there,

    Thanks for reaching out 😄

    Sorry for the wait! We’ve been experiencing a high volume of support requests.

    Can you explain what you’re trying to do with this query? we have some helper functions that might be more efficient.

    Take care,
    Ed 🤟

    Thread Starter sergioes

    (@sergioes)

    Hello @erishel,
    Thanks for the reply!

    I am trying to get all the upcoming events in a specified venue. For this I am using the function provided in the plugin documentation: tribe_get_events(). Here is the code snippet, I am not using a query, just tribe_get_events():

    $events = tribe_get_events(array(
    	'eventDisplay'=>'list',
    	'posts_per_page' => 4,
    	'meta_key'=> '_EventVenueID',
    	'meta_value' => 109, 	
    ));

    The issue is that tribe_get_events() is returning the venue ID as the EventStartDate.

    [EventStartDate] => 109
    [EventEndDate] => 2019-09-30 17:00:00
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘tribe_get_events returns wrong data’ is closed to new replies.