jeudi 14 avril 2016

WP_Query category parameter is not working

I am creating shortcode with attributes and all attributes working except event_category. When i add "event_category" attribute it is not giving result as per added category.

Here are my shortcode attributes

    // Shortcode Default Array
            $default_shortcode_attrs = array(
                'type' => 'upcoming',
                'search' => 'true',
                'event_category' => '',
                'events_limit' => '-1',
            );

    extract(shortcode_atts($default_shortcode_attrs, $attr));

Following are query parameters

     $args = array(
                'posts_per_page' => -1,
                'post_type' => 'event_listing',
                'post_status' => 'publish',
                'event_listing_category'=> $event_category,
            );
     $query = new WP_Query($args);

"event_listing_category" is name of custom taxonomy. Please guide me why this query is not fetching the events according to their category.

Any help will be appreciated.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire