How can I get the last 5 element of this tax query?

add the ‘date_query’ parameter to your query and include the current year. $args = array( ‘post_type’ => ‘news’, ‘posts_per_page’ => 5, ‘post_status’ => ‘publish’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘week’, ‘field’ => ‘slug’, ‘terms’ => date(“W”, strtotime(“this week”)), ) ), ‘date_query’ => array( array( ‘year’ => date(“Y”) ) ) );

Custom search for a custom post type in WordPress

Change operator to IN: array( ‘taxonomy’ => ‘features’, ‘terms’ => $feature_slugs, ‘field’ => ‘slug’, ‘operator’ => ‘IN’, ), That will query posts that have any of the terms in $feature_slugs, rather than all of the terms, which is what AND does. Also, I can see you’re using the POST method for this search. That type … Read more

Query child posts with tax query on parents

My solution to this ended up splitting this into 2 queries: Get the IDs of all the parent products I want to ignore Get all the variations that don’t a post_parent from that list of IDs $archived_products = wc_get_products( array( ‘type’ => array( ‘variable’, ‘variable-subscription’ ), ‘paginate’ => false, ‘limit’ => -1, ‘category’ => array( … Read more

list all post who have mutual taxonomy as current taxonomy!

No custom programming answer: A plugin like https://facetwp.com/ will allow you to set up filters as you have described. Custom programming answer: You can create a shortcode that renders fields for the user to check and submit. Then, attach a javascript submit handler to the form so that when the user checks a box or … Read more