How to display just video post format?
How to display just video post format?
How to display just video post format?
Error get_posts with Custom Taxonomy and OR relation
You don’t need to add single quotes before using $exclude. Literals are enclosed in quotes to show it’s a string, but since $exclude is already a string variable, you can pass it directly. Remove $excluded, you don’t need it at all and just use $ogpk_pickup_field_args = array ( ‘depth’ => -1, ‘class’ => ‘store-pickup form-row-wide’, … Read more
try this.. $args = array( ‘post_type’ => ‘videolesson’, ‘ordeby’ => ‘rand’, ‘order’ => ‘DESC’, ‘posts_per_page’ => 8, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘level’, ‘field’ => ‘slug’, ‘terms’ => ‘beginner’, ‘compare’ => ‘IN’, ), array( ‘taxonomy’ => ‘subjects’, ‘operator’ => ‘EXISTS’ ) ), ); $getting = new WP_Query( $args );
Looks like a common problem: meta_query & tax_query combined = fail. Look, i’ve the same problem and i mentioned two links (possible solutions for you) in my question (Combine tax_query and meta_query in WP_Query). Can you use/handle something of this? If yes, maybe it’s your solution.
Ok, I’ve just tested this in my installation (with a taxonomy that exists here). Usually, I just quickly throw stuff into the functions.php and look at the SQL that’s generated (print $event_query->request;). That didn’t work and the tax_query always generated 0 = 1 thus making sure that there were no results. Finally, heureka, the taxonomy … Read more
Good days. I found a better approach. I have a custom function that looks at the multi-dimensional array and determines if they are empty. Using that I found a way to dynamically add tax_query array into the main query for my wp_query. I kept the “pool” in the main $args. I removed the month and … Read more
I’ve came up with the not perfect solution to this: Because I am using term_taxonomy_id I can just add all the IDS and remove the taxonomy specification like this: ‘tax_query’ => array( array( ‘field’ => ‘term_taxonomy_id’, ‘terms’ => array(…all ids…) ) ) And it works! This is a quick solution, although it will work in … Read more
You can use a meta_query in addition to your tax_query : https://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters I have in which if statement you want to use it so I put it in the of the code. $names = array( ‘fields’ => ‘names’ ); $prac_names = get_terms(‘attorney-practice’, $names); $prac_matches = array_shift(preg_grep (‘(‘. $search .’)’, $prac_names)); $off_names = get_terms(‘office-location’, $names); $off_matches … Read more
Your taxonomy Query is worng. please try something like that: $args = array( ‘post_type’ => ‘contact’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘abteilung’, ‘field’ => ‘term_id’, ‘terms’ => ’29’, ), ), );