You can access the terms with the get_the_terms
function. You can pass the name of the taxonomy as well as the ID to the function. Make sure to grab the ID correctly inside the loop – get_the_ID() should work. After that it’s a matter of joining the results with comma separation. With array_merge you can add also additional arrays that you need.
$x_terms = get_the_terms( get_the_ID(), 'any-taxonomy-slug');
$y_terms = get_the_terms( get_the_ID(), 'another-taxonomy-slug');
$terms = array_merge($x_terms, $y_terms);
foreach($terms as $term):
$term_names[] = $term->name;
endforeach;
$names = join( ", ", $term_names );
Related Posts:
- Querying on multiple taxonomies pulled from $_GET checkbox array not working?
- WordPress tax_query “and” operator not functioning as desired
- Show posts without term
- Why is my WP_Query not working when tax_query terms are an array?
- List taxonomy terms plus their latest post ordered by post date
- Querying by taxonomy vs Querying by Custom fields Speed Comparison
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- tax_query shows no results if nothing is selected
- Get array of current post term ID’s
- How to add terms to my tax_query based off of the current post
- Change default ordering of taxonomy terms – pre_get_terms
- WP_Query, tax_query and term_meta: How to?
- Empty tax_query array returns an empty array
- Get list of terms that have posts in another term
- Function get_queried_object() return NULL in custom taxonomy
- List custom taxonomy terms sharing posts with a term from a second custom taxonomy
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Filter Custom Taxonomy Posts
- How to add custom meta to ‘pre_get_terms’?
- Tax Query only returns for the first of several terms
- get term id from term name
- WP_Query to output chosen term and posts with no term assigned
- WP Job Manager plugin – Listing only the twelve job categories on frontpage order by jobs they have
- Check if a post has term inside loop
- How to restrict search on a certain page to only return results against custom taxonomies?
- display ACF repater field in archive page
- list all post who have mutual taxonomy as current taxonomy!
- Optimal way to make tags in tax_query optional?
- How to define a custom hierarchy for terms?
- How can I get all the posts that are related with a specific taxonomy term?
- How to combine nested tax_query logic with other nested query logic?
- tax_query not working for taxonomy slug
- Custom query for tag and custom tag from 2 post type
- How to get hierarchical number of custom taxanomy
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Custom taxonomy query broken after upgrade to 4.4
- Custom Taxonomy and Tax_Query
- query multiple taxonomies
- Query two taxonomies via URL or link?
- Counting number of posts with Category B in Category A
- search query within custom taxonomy term, post title and meta field
- WooCommerce: filter by parent product’s taxonomy and product variation’s meta data
- Using tax_query reverses my post_type argument in a custom WP_Query
- why do drafts return as part of wp_query?
- get complex results set according to category structure
- Dynamically tax_query terms
- Setup of taxonomy term template pages
- How to do a query on custom taxonomies that is uncategorised?
- Pass array of taxonomy terms to wp_query
- Formulate a url to show posts with both taxonomy terms
- tax_query: Order by slug?
- Query with custom taxonomy not working
- Taxonomy search/filter with multiple taxonomies and multiple taxonomy terms
- ‘wp’ action hook not firing in admin and login?
- Taxonomy archive showing no results
- WordPress Related Post by tags in Single.php
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Query custom post type by custom taxonomy (category slug)
- How to Filter Posts by Custom Fields?
- WordPress loop: Show only a Custom Post Type Taxononmy TERM
- wp_query for multiple cities (multiple values in a metabox)
- How to order posts by title after they have already been sorted by category
- Set tax_query conditionally with new WP_Query
- Query with meta_query and tax_query together not working properly
- Adding a tax_query to a WP_Query Object
- WP_Query args to show posts from specific custom taxonomy
- Order or Orderby in tax_query (How to define order of terms in WP_Query)
- Using custom taxonomies in a query
- Count posts per taxonomy else change taxonomy if less than x number
- How to add tax_query to $args with concatenation
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- Tax_Query using WP_Query not working
- Can’t get term id for category archive
- How to make a post with certain taxonomy term display first before other post with only one query?
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Show X taxonomies of the latest published posts
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- Get categories within specific term
- Only return taxonomies that are linked to a category & product
- Query WP Posts, then list the taxonomies from those posts
- Displaying Pages in Nav Sub-Menu with Specific Taxonomy Terms?
- WordPress tax_query ignoring relation OR
- Taxonomy Terms That Don’t Exist Display Results
- display all posts from category with and without terms in chronological order
- How to create page that lists tags by initial letter?
- In Product Category archives how to show Posts having same/similar prod_cat slug structure?
- Extending WP Query: Custom geolocation meta values work, but tax_query breaks
- WP_Query to show post from a category OR custom field – Not 100% answered
- Add a custom variable to query page object
- tax_query showing no results
- Page displaying 1st post from a range of custom tax?
- WordPress WP_Query Array Custom search via taxonomies
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Tax query array terms display out of order
- Advanced AND tax_query in sidebar with 2 taxonomies
- tax_query not working properly with get_posts
- query only direct child and sub-terms of a current term archive
- Get access to all terms associated to each post that the wp_query loop displays
- Custom query with custom filtering returning incorrect results