New answers tagged

0

Let's say you have 5 instances: 200, 201, 202, 203, 204 NOT IN {200, 201, 202} is equal to IN {203, 204} (all the other instances). So you don't need your IN operator anymore because its results are already included from using the NOT IN operator. In your case, this logic works assuming an article does not have multiple locations. $query->set('...


0

You have a couple of issues here. As your code stand, $post is undefined. It is actually better to make use of get_the_ID() to get the post ID instead of $post wp_get_post_terms() makes an extra db call, so if you are really set on performance, I would rather use get_the_terms() You are returning term names, but then set the field parameter in your ...


0

You'll need to loop through each of the terms in your main query conditional. Assuming there will likely be more than one term with the custom data, you'll then need to pass an array of IDs into your tax query. For example, looping through each term to check for custom meta: $term_args = array( 'taxonomy' => $taxonomy_name, ); $terms = ...


1

From the get_terms documentation: orderby (string): Field(s) to order terms by. Accepts term fields ('name', 'slug', 'term_group', 'term_id', 'id', 'description'), 'count' for term taxonomy count, 'include' to match the 'order' of the $include param, 'meta_value', 'meta_value_num', the value of $meta_key, the array keys of $meta_query, or 'none' to omit ...



Top 50 recent answers are included