What you are doing seems odd. You are creating and retrieving an HTML string only to strip out the HTML.
Try this:
$terms = get_the_terms( $post->ID, 'genre' );
// var_dump($terms);
$tnames = array();
if (!is_wp_error($terms) && !empty($terms)) {
foreach ($terms as $t) {
$tnames[] = strtolower($t->name);
}
$genre = implode(', ',$tnames);
}
// var_dump($terms);
You can un-comment the var_dumps
to get an idea of what is happening. You can change the first parameter of implode
to change the separators– right now it uses a comma.
Related Posts:
- Output Taxonomy Title as Part of Result
- Remove title attribute from tag cloud widget [duplicate]
- The Difference Between Hierarchical and Non-Hierarchical Taxonomies?
- How to get taxonomy term of the current page and populate queries in the template
- Custom taxonomy list page?
- What is wp_insert_term “alias_of” arg for?
- wp_set_object_terms() — prevent overwrite?
- List Hierarchical Term List with Count with Related Term
- Is there a way to set singular/plural labels for taxonomy term names?
- List taxonomy terms as links
- Get_term_by only returns one item from array
- Can we have same term slug in different taxonomies?
- Add additional data to a specific taxonomy term when used in a post
- How to have “the most used tags” taxonomy always expanded?
- Get parent and first child taxonomy terms?
- Display Post by taxonomy and taxonomy child if exist
- What hooks/filters are there to alter selected terms on post save?
- Filter blog archive by category in URL
- tax_query: What to pass when I want to have all terms?
- Custom Roll/Custom Post Type – Can’t Select Categories
- Trying to list terms of a custom taxonomy using get_categories
- Add a term to an attachment submitted from front end
- Get and loop posts with all taxonomy terms
- Unable to delete a Category and Tag that share same slug
- what tables uses wp_get_post_terms
- How to filter out post type meta?
- I need template for my custom taxonomy term
- Show list of custom taxonomies when another taxonomy is selected
- WordPress as thesaurus/dictionnary: what approach?
- List a current posts’ taxonomy terms in a widget in WordPress
- Should I be using custom post types for this or terms and taxonomies?
- How can i list the categories of a post type, the taxonomy
- Custom WP Query: force entry for some taxonomy and have others optional
- Set post terms on post publish
- How to display terms from a custom taxonomy in a hierarchy AND with custom html markup?
- How can I find the taxonomy in edited_{taxonomy}?
- Using get_posts() with tax_query parameter set isn’t working with attachments
- extend HierarchicalTermSelector function with custom renderTerms
- Searching in wordpress using wp_term_taxonomy table
- How to get the top level parent term Advanced Custom Field values in the child terms
- Allow a Taxonomy Term to be Used Only Once Across All Posts
- Pulling Data from CSV vs. pulling data from database
- Count Published & Draft Posts Associated With Each Term
- “AND” relation in custom taxonomies
- Problem with Query on Taxonomy
- get_the_term_list – Return links to edit.php instead of link to taxonomy archive template
- How to sync to custom taxonomies (tag structure)
- the_terms characters not limiting
- Hierarchical list of custom taxonomy terms
- echo term name outside the loop, using term slug
- What are these undocumented arguments for register_taxonomy?
- Dynamic filtering of posts with custom taxonomies
- Sorting tags by name
- get_term_by seems to be failing
- How to return newly added terms when using wp_set_object_terms
- How to get terms from a custom taxonomies after WordPress 4.5.0
- How to update a taxonomy term for a custom post type with auto incrementing number
- Search Media by taxonomy
- Get Taxonomy name from “registered_taxonomy” hook
- Filtering elements by taxonomy slug
- Echo taxonomy name – second level
- Show only first child in dropdown
- Taxonomy page shows category in title
- Get terms in hierarchical taxonomy
- Taxonomy Checkbox Admin Panel
- Replacing a placeholder term with a session variable value in taxonomy filter
- Loop problem – Taxonomy
- Select query with two and two related taxonomies
- How to relate to 2 taxonomy with category
- Taxonomy Dropdown Question
- WP Search using taxonomy terms
- Customize menu link for taxonomy in WP menu
- How do I converge taxonomy category permalinks into one?
- Taxonomy terms are not checked when edit custom post
- Url leading to archive page, no matter what
- Checking if a product ID has taxonomy term attached not working with has_term
- Can I create a tax query to return posts that match two slugs from same taxonomy
- Taxonomy.php inheriting first post
- Display related terms from a taxonomy in an entry
- I want to get term by term_name without taxonomy
- What is this Query? and why its taking too much time? Any way to optimize it?
- taxonomy terms, inverted
- Same page for startpage and archive?
- How to share terms between two taxonomies?
- Taxonomy Rewrite Problem
- Taxonomy terms can’t find posts from archive.php or taxonomy.php
- What to do with shared terms splitting in WordPress 4.2?
- How to get a query odered by N of matching taxonomies?
- GET Taxonomy ID
- Hiding an Advanced Custom Field based on Taxonomy Field selection
- Non-Recursive get_term_children()
- How do I add tags/taxonomy to images + a query field on page to query ‘albums’ (images with same tag/taxonomy)
- Delete Term via edit-tags.php
- multiple taxonomies in wp_list_categories’ $args
- Description of a sub-taxonomy
- Order taxonomy terms by the frequency of use in the last 30 days
- I need to add new menu item inside the custom post admin menu
- How to orderby Taxonomy Term in a WP Query
- Hiding a tag from display
- taxonomy change to post/page type