How can I hide uncategorized products from search results?
How can I hide uncategorized products from search results?
How can I hide uncategorized products from search results?
I managed to answer this question myself by adding get_queried_object()->term_id; instead of the taxonomy terms ID. It now outputs all the grandchild taxonomy terms for the current taxonomy term. Here is my updated working code: $term_id = get_queried_object()->term_id; $taxonomy_name=”product_range”; $term_children = get_term_children( $term_id, $taxonomy_name ); echo ‘<ul>’; foreach ( $term_children as $child ) { $term … Read more
I found the answer here. They were having the exact same problem: Using tax_query reverses my post_type argument in a custom WP_Query It is a problem with the Easy Content Types plugin. Pippin, the author of this plugin wrote the following: The problem is caused by a function in the plugin that helps to resolve … Read more
More then one menu items are assigned with “current-menu-item” class
It’s not possible without a more custom query/filter. I have achieved it with a filter (code taken from this guy on this gist – https://gist.github.com/elvismdev/61f8509eff8abcc21ef84154b74fbf56) function f1_egpaf_meta_or_tax( $where, \WP_Query $q ) { // Get query vars. $tax_args = isset( $q->query_vars[‘tax_query’] ) ? $q->query_vars[‘tax_query’] : null; $meta_args = isset( $q->query_vars[‘meta_query’] ) ? $q->query_vars[‘meta_query’] : null; $meta_or_tax … Read more
The loop for $listings should include a call to $listings->the_post() so that the global post object is assigned to the current listing in the loop: while ( $listings->have_posts() ) { /*** Add the following line: ***/ $listings->the_post(); $post_get = get_the_ID(); $term_get = get_the_terms($post_get, ‘Car_Series’); $term_array = $term_get; print_r($term_get); array_push( $term_array, $term_get); } Without this, functions … Read more
Using meta_query and tax_query at the same time
Why is this query not working? (Standard posts + custom post type)
Tax query in pre_get_posts not working
Tax Query for custom Taxonomy field