TransWikia.com

get_terms based on post meta value

WordPress Development Asked by traummaschine on February 22, 2021

I’m listing events using the following arguments for my query, these load in via ajax and have a filter:

$date_args = array(
   'post_type'   => 'events',
   'meta_key' => 'event_start_date',
   'posts_per_page' => 20,
   'orderby' => 'meta_value_num',
   'order' => 'ASC',
   'meta_query'=> array(
      array(
         'key' => 'event_start_date',
         'compare' => '>',
         'value' => date("Y-m-d"),
         'type' => 'DATE'
      )
   ),
);

This displays future events only (using the event_start_date key), and this works fine.

My question: is there any way of using get_terms to get a list of terms for the filter, for future events only?

I only want terms associated with future events to be displayed (terms only associated with past events would be ignored, similar to hide_empty).

I’ve searched around and haven’t been able to find a solution to this. Thanks in advance for any help.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP