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
- Adding a language rule and displaying posts with a custom taxonomy term on its archive page
- exclude product with available tag
- How to add tax_query to $args with concatenation
- Getting the post terms ‘wp_get_post_terms’ per post when within the functions.php file
- One WP_Query that always shows 1 post from category X and 1 post from “not in category X”?
- Custom Category Walker with Image, Fallback to Most Recent Post in Category Image
- Get posts in taxonomy randomly
- Loop posts based on permalink term
- Using WP_Query for categories instead of get_terms
- How to search for meta_query LIKE or tax_query LIKE and grab these posts on search results?
- Is it possible to add relation between meta_query and tax_query?
- tax_query (if the terms are empty)
- Grabbing taxonomy terms and inserting them into an array
- Create alphabetical Pagination for custom taxonomy?
- How to get posts by category and by choosing a taxonomy term?
- Query Taxonomy By Page Title
- Function using get_posts() with tax_query not working when called from functions.php
- Custom Taxonomy Breaks Pages
- Wp_query…a type of term a different div
- WP_Query tax_query – Show results if child has parent X
- how to use tax_query to apply both terms or one if one is empty
- Tax_Query using WP_Query not working
- Show multiple tax_query from 2 or more post_type in a single code
- Deleting terms from the WordPress wp terms table
- Query for specific taxonomy that executes a particular loop depending on volume of posts?
- get_the_terms has strange result since version 6.0
- How to display posts from custom post type category(custom Taxonomy) wise?
- Can’t get term id for category archive
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- How to make a post with certain taxonomy term display first before other post with only one query?
- Any quicker alternative for WP_Query “NOT IN”
- Tax Query on product_cat using NOT IN as operator does not exclude that category
- wp-query and wp_get_post_terms on custom taxonomy archive page
- Why is my pagination /page/2 taking me to index.php?
- Show X taxonomies of the latest published posts
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- Facing problem with tax_query results
- How can I order a post query’s results based on the number of matching taxonomy terms?
- WP Query should show No Posts when tax_query $args taxonomies don’t have associated posts
- Only show tag with the same id as the post
- custom post type and a “sticky” position taxonomy
- display post count in archive page that have relation with another taxonomy term
- Filter for each loop when WP_Query has no posts to show
- Save queried result into database
- Custom Taxonomy – Modify Function to Get Child Category
- WP_Query for a taxonomy value OR a custom post type meta field
- WP Query by 4 different taxonomies
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- How do I stop the same post showing multiple times in a archive?
- wp_query with meta_query and tax_query
- How to search through all child taxonomies using WP_Query?
- Get categories within specific term
- Related categories order posts by category
- WordPress – Form does not filter the results of taxonomies
- Select multiple categories with is_tax
- WP Query for all events prior to current date
- How to get taxonomy image attached to a Post Type WordPress
- How to display Woocommerce products list by tag
- Why pagination is not working with tax_query param?
- WordPress post_status and meta_query
- Only return taxonomies that are linked to a category & product
- Show one post of each custom taxonomy
- Query WP Posts, then list the taxonomies from those posts
- Query child posts with tax query on parents
- posts_per_page in a tax_query