How to find objects by terms

Assuming “users” you are trying to pull is a custom post type. You can use “tax_query” as below. $user_args = array( ‘post_type’ => ‘custom_user_post’, // Custom post type, ‘posts_per_page’ => 10, ‘paged’ => ( ! empty( get_query_var( ‘paged’ ) )? get_query_var(‘paged’): 1 ), ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘user_sports’, //assuming your … Read more

display multiple term post from taxonomy in a single page

Thank you for your time answering my unclear question. The code I found is the one that Im looking for. Thank you again 🙂 <?php //http://codex.wordpress.org/Function_Reference/WP_Query#Taxonomy_Parameters $term_slug = get_queried_object()->slug; if ( !$term_slug ) return; else $args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘gallery_category’, ‘field’ => ‘slug’, ‘terms’ => $term_slug, ‘posts_per_page’ => 10 ) … Read more

Search Terms – Querying on either description__like OR name__like in the same Term Query?

I don’t see any options for WordPress to search terms by both of name & description. So i combined 2 queries like @StephanieQ but maybe more simple way, checkout my ajax response below: public function ajax_project_terms_search() { $results = array(); $search_query = sanitize_text_field($_GET[‘q’]); $withname = intval($_GET[‘withname’]); $search_keys = array(‘name__like’, ‘description__like’); $exclude = array(); foreach ($search_keys … Read more

How to hook get_terms() to only show count of posts that have custom meta

As far as I remember counts for terms are stored in database, so there is nothing to modify when you fetch them – you simply get ready-made numbers. So you will either need to implement and maintain your special logic for counts completely separately or try to recalculate and modify native counts, see wp_update_term_count_now().