Taxclass based on certain conditions: location+userrole
Taxclass based on certain conditions: location+userrole
Taxclass based on certain conditions: location+userrole
Same query args showing different results order when setting different number of posts
Try adding include_children parameter as false to your first example (tested): $args = array( ‘post_type’ => ‘workshops’, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘workshop_categories’, ‘field’ => ‘slug’, ‘terms’ => array( ‘crafts’, ‘jewellery’ ), ‘operator’ => ‘AND’, ‘include_children’ => false, ) ) ); $posts = get_posts( $args ); Unfortunately I … Read more
Tax query: exclude posts if ONLY a certain term is applicable
You can add taxonomy-subtopic-copyright.php and taxonomy-subtopic-trademark.php archive templates if you need that much granularity.
You should not modify the taxQuery value, or that it should always be in the form of {“<taxonomy>”:[<term IDs>],”<taxonomy>”:[<term IDs>],”<taxonomy>”:[<term IDs>],…}. But you can add custom arguments, so “categoryName”:”news” is good. And then you can use the query_loop_block_query_vars filter to add the category slug to the WP_Query arguments coming from the Query Loop block. Here’s … Read more
Your query syntax looked good, although you could instead add a direct meta/taxonomy query clause array such as $meta_query[] = array( ‘key’ => ‘_price’, … ) instead of $meta_query[] = array( ‘relation’ => ‘AND’, array( ‘key’ => ‘_price’, … ) ). However, I spotted 2 main issues with your code: Issue 1: Your custom pagination … Read more
Set your system up like this: locations – CPT administrative – hierarchical taxonomy natural – hierarchical taxonomy type – non-hierarchical taxonomy In the administrative taxonomy, you would create your tree: countries on the first level, regions second, departments and so on. Then, you would assign your locations to the smallest administrative denominations among your taxonomies … Read more
If it’s not too much of work, you could switch from using meta data to custom (private) terms for tagging the tickets to agents. So when ever an agent (user) is created, you would have custom function run that executes wp_insert_term to create an agent-term, where the newly created user ID is used as the … Read more
First, take a look at this: https://developer.wordpress.org/reference/classes/wp_query/ You can filter by querying by post type, or in a single query (code between /* */). <?php //This is the first query $query_A = array( ‘post_type’ => ‘post_type_A’, ‘post_status’ => ‘publish’, //’cache_results’ => true, ‘posts_per_page’ => 10, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’, ‘fields’ => ‘ids’//add by … Read more