taxquery taxonomy get terms

so if $trips_list is the sample trips section, and you want the sample trips to only show trips with the same terms – you’d find the current trips term and argue that in your WP_Query. // this trips terms $tripTerms = wp_get_post_terms( get_the_ID(), ‘reisezweck’); // if each trip only has one term (as its a … Read more

Confused by get_the_terms to use in a new wp_query

$terms is an array of terms, so PHP doesn’t know what you mean when you say $terms->slug. With foreach, you’re iterating through this array. If you only care about the first element, you can simply use $slug = $terms[0]->slug;. This will get you in trouble when there are no terms, though, so you will want … Read more