How to order the get_categories result

Firstly, $product->get_categories() won’t work because it’s a woocommerce function, that basically is just a wrapper for get_the_term_list, which has no sorting parameter. It’s always good to take a look at the source to know what you’re dealing with. Secondly,get_the_term_list uses get_the_terms, but it also has no sorting parameter. The latter get the terms either from … Read more

Get terms from multiple taxonomies

If you want to retrieve multiple taxonomies you need to put the four taxonomies in an array, you are doing this, but you have put taxonomy=> in the array. $terms = get_terms( ‘taxonomy’ => array( ‘vehicle_safely_features’, ‘vehicle_exterior_features’, ‘vehicle_interior_features’, ‘vehicle_extras’) ); Hope it helps

Why is my WP_Query not working when tax_query terms are an array?

When you’re doing a tax_query or meta_query in a WP_Query, you always have to use a nested array( array() ); just see the following example for an explanation and pay attention to the relation argument. $packages = new WP_Query( array( ‘post_type’ => ‘vamos-cpt-packages’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘vamos-holiday-types’, ‘field’ => … Read more

Retrieve single term slug

Thank you guys for such quick response. Much appreciated! Here is code for “global” Tags page (displaying terms of default ‘post_tag’ taxonomy): <?php $term_slug = get_queried_object()->slug; if ( !$term_slug ) return; else $loop = new WP_Query( array( ‘post_type’ => ‘any’, ‘tag’ => $term_slug, ‘posts_per_page’ => 10 ) ); while ( $loop->have_posts() ) : $loop->the_post(); ?> … Read more