Monday, 27 May 2013

When using Tribe Events Calendar, querying for a specific event category returns nothing

When using Tribe Events Calendar, querying for a specific event category returns nothing

I'm still new to wordpress and I'm trying to write a plugin but for some reason this code is producing nothing. Why? I am completely stumped. I have followed the examples here to a tee.
<?php
    /*
    Plugin Name: Text
    */

    add_action("init", "init_stuff");

    function x_get_event_posts(){
        $all_events = tribe_get_events(
            array(
                'eventDisplay' => 'all',
                'posts_per_page' => -1,
                'tax_query'=> array(
                    array(
                        'taxonomy' => 'tribe_events_cat',
                        'field' => 'slug',
                            'terms' => 'xmlworkshopdonotuse'
                        )
                )
            )
        );

        echo count($all_events); // produces "0";
    }

    function init_stuff() {
        x_get_event_posts();
    }

?>

No comments:

Post a Comment