display post count in archive page that have relation with another taxonomy term

SOLUTION <?php $args = array( ‘post_type’ => ‘product’, ‘post_status’=>’publish’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘sectors’, ‘field’ => ‘slug’, ‘terms’ => ‘garden’, ), array( ‘taxonomy’ => ‘season’, ‘field’ => ‘slug’, ‘terms’ => ‘winter’, ), ), ); $query = new WP_Query( $args ); echo $query->post_count ; ?>

WP_Query: how to search tags in addition to a custom post type?

Seems that WP_Query does not have the ability to query tags or categories. I ended up using the get_tags WordPress function and passed in the search term then merged the result with the WP_Query of the “places” endpoint. function placesSearch() { register_rest_route(‘placesdb/v1’, ‘search’, array( ‘methods’ => WP_REST_SERVER::READABLE, ‘callback’ => ‘placesSearchResults’ )); } function placesSearchResults($data) { … Read more

Display post count for a specific month

here is correct answer if someone need $aprel = get_queried_object(); /////////////////////////////////////////////////// $aprelpost = array( ‘post_type’ => ‘sikayet’, ‘post_status’=>’publish’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘sectors’, ‘field’ => ‘slug’, ‘terms’ => $aprel->slug, ), ), ‘date_query’ => array( ‘year’ => 2021, ‘month’ => 3 ) ); $aprelpost_query = new WP_Query ( $aprelpost ); $ap … Read more