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 custom posts: filter results to custom taxonomy tag that corresponds to user meta field

You would not do this using SQL, and you don’t need to. Use PHP instead. For example, this code adds a search parameter to the query, but the value changes depending if the user is logged in: add_action( ‘elementor/query/article_video_together’, function( \WP_Query $query ) { $foo = is_user_logged_in(); if ( true === $foo ) { $query->set( … Read more

Get dropdown child categories from parent category of custom post type

WordPress always has similar function to a list, you may try wp_dropdown_categories instead of wp_list_categories. It takes almost the same arguments, which is not related to list items. $tax = get_term_by(‘slug’, ‘cursos’, ‘portfolio_category’); $tax_id = $tax->term_id; $args = array( ‘child_of’ => $tax_id, ‘taxonomy’ => ‘portfolio_category’, ‘orderby’ => ‘name’, ‘show_count’ => 0, ‘hierarchical’ => 0 ); … 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

Error 404 change permalink term custom term taxonomy

If you just want the category permalink be in the form of: example.com/products/category/<category slug>, then you don’t need to hook on term_link. Instead, you could just set the taxonomy’s rewrite slug to products/category and you would also register the taxonomy first then followed by the post type. That way, WordPress would see the request (at … Read more