Can I create a tax query to return posts that match two slugs from same taxonomy
Can I create a tax query to return posts that match two slugs from same taxonomy
Can I create a tax query to return posts that match two slugs from same taxonomy
What you’re trying to do — using the OR relation with the tax_query and meta_query parameters, i.e. to have a <tax queries> OR <meta queries> instead of <tax queries> AND <meta queries> command in SQL, unfortunately (without custom and possibly complex queries) is not possible in WP_Query for now, therefore that ‘relation’ => ‘OR’ in … Read more
I’ve managed to write an SQL query that would get all product variation IDs that do not have both size and color set up (not present in the wp_postmeta table). After that I just need to loop through these IDs and delete those variations using wp_delete_post. This is the query: SELECT p.ID FROM wp_posts p … Read more
custom post type and a “sticky” position taxonomy
Tax query get first product with attribute value in pre_get_posts
Multiple dynamic Tax Query – pass taxonomy argument from array
WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
I was building something similar a couple of years ago, here’s what I did, maybe it helps … (changed to your use case) $result = new WP_Query([ ‘post_type’ => ‘location’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1, // all of them on one page ‘tax_query’ => [ [ ‘taxonomy’ => ‘services’, ‘field’ => … Read more
How is ‘products_article_list’ meta returned from in $article_list? <?php $article_list = get_post_meta( get_the_ID(), products_article_list’, true);?> Is it a list of ids eg. ‘0601,0603’ or is it an array? tax_query terms argument requires an array. See https://developer.wordpress.org/reference/classes/wp_query/#taxonomy-parameters So if it’s stored as a list of ids all you need to do is explode the list and … Read more
So you want to show only posts that have both employee and full-time categories. If that is the case than you can do the following. Because you haven’t posted the full query args I will only show the tax_query part ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => … Read more