get_categories with meta query
-
$today = date('Ymd', strtotime("now")); $args = array( 'type' => 'events', 'orderby' => 'name', 'order' => 'ASC', 'meta_query' => array( array('key'=>'date', 'compare' => '>=', 'value' => $today, ) ), ); $categories = get_categories($args); foreach ($categories as $category) { echo '<button data-filter=".'.$category->slug.'">'.$category->name.'</button>'; }
I’m building a jQuery filter for a list of events. For this i need a list of all category names used, but only for future events. I’m already using a meta query for the list of custom post type events, but the meta query does not work with get_categories.
How can i list all categories used in future events?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_categories with meta query’ is closed to new replies.