What you are looking for is get_the_terms()
. You can get custom terms for the current post by using the following code:
$post_tags = get_the_terms(get_the_ID(), 'portfolio_tags_client');
if ($post_tags) { ?>
<div class="tags-div">
<h3><?php _e( 'Tags', 'text-domain' ); ?></h3>
<div class="post-tags"><?php
foreach($post_tags as $tag) {
echo '<a href="'.get_tag_link($tag->term_id).'" title="'.$tag->name.'">'. $tag->name .'</a>';
} ?>
</div>
</div><?php
}
This should be used in your single.php
or the template that renders the content of your post. get_the_term()
itself can be used anywhere, but since you have to pass the post’s ID to it, you should use it in the proper template files.
Related Posts:
- Set attachment tags from attachment’s custom field data
- How to sync to custom taxonomies (tag structure)
- Is There a Difference Between Taxonomies and Categories?
- How to show a hierarchical terms list?
- Need a simple but complete example of adding metabox to taxonomy
- Automatically Assign Parent Terms When A Child Term is Selected
- Control term order on a per-post basis
- get term by id without taxonomy
- wp_set_object_terms() Fails to Set Terms
- show tags of custom post type ONLY
- get_terms with posts that have a different taxonomy with term x
- List all taxonomy terms / Show links if posts are attached, else names
- Get_term_by only returns one item from array
- How to have “the most used tags” taxonomy always expanded?
- WP native tag suggest metabox. How does it process tag id?
- Change order of WordPress tag cloud
- How to get the last term from taxonomy?
- Count posts for each taxonomy term for each month
- List post from current taxonomy children
- What hooks/filters are there to alter selected terms on post save?
- Count argument in get_terms has no effect on ouput/doesn’t work
- orphaned taxonomy terms remove by sql query
- Unable to delete a Category and Tag that share same slug
- Allow only 1 instance of each term in each custom taxonomy
- has_term not working
- taxonomy/category term in URL slug irrelevant for post?
- Filter taxonomy terms using multiple id in the edit-tags.php
- How to use a Term Meta Field as a link
- WordPress built-in method to extract array of term IDs?
- WordPress as thesaurus/dictionnary: what approach?
- Should I be using custom post types for this or terms and taxonomies?
- get_terms problem : related articles
- Set post terms on post publish
- Why “Warning: Invalid argument supplied for foreach()”
- WordPress User Taxonomy Saved Values
- get_the_terms error
- How can I find the taxonomy in edited_{taxonomy}?
- Set multiple Post Terms in same Taxonomy
- Show child terms of current term of the taxonomy
- conditional statement based on terms
- Is There a Difference Between Taxonomies and Categories?
- get_the_term_list – Return links to edit.php instead of link to taxonomy archive template
- Why does WP_Query strip colons from tag names?
- Comma separated tax terms, with “and” before last item [duplicate]
- the_terms characters not limiting
- 100+ terms in any taxonomy slows down post updates?
- Hierarchical list of custom taxonomy terms
- Categorize wordpress tags
- How to make tags show up in search results?
- How to return newly added terms when using wp_set_object_terms
- Blogroll links sorted by category in a table
- How to relate a user object to taxonomy term?
- How to display taxonomy term custom meta (using wp_get_object_terms?)?
- SQL query joining on taxonomy tables not returning what I would expect
- Echo taxonomy name – second level
- Match and Merge Terms in Different Taxonomies
- Get terms in hierarchical taxonomy
- How can I query all post with currrent taxonomy term?
- Taxonomy Checkbox Admin Panel
- Retrieve all term IDs of post
- How to order a taxonomy’s terms numerically, from lowest to highest using get_terms
- update_term_meta not working
- Tags hierarchical
- Calling an Archive Page with specific Tag/Tax ID
- Assign Multiple Values from Post Fields to Taxonomy Terms
- Set two terms for a post when they differ only by an accent
- wp_insert_term doesn’t want to enter its data into custom taxonomy
- $_POST sometimes empty even though isn’t when using edited_[taxonomy] hook
- Only show tag with the same id as the post
- Checking if a product ID has taxonomy term attached not working with has_term
- What is the use case for sharing a term between multiple taxonomies?
- Order custom taxonomy hierarchy
- I want to get term by term_name without taxonomy
- I want to change the slugs of my terms dynamically
- How to show children terms even if they are empty
- show recently added tags to tag cloud
- taxonomy terms, inverted
- taxonomy_edit_form_fields output after term fields
- “If an object equals a term id then return the term name”
- Create multidimensional array of taxonomies
- $product->ID in has_term() not working, but manually inputting the ID works, why?
- Can I have have terms with the same slug in the same taxonomy?
- how do you get one specific term from a shortcode attribute?
- Taxonomy terms can’t find posts from archive.php or taxonomy.php
- What is the earliest hook you can piggyback on to check terms/taxonomy for a collection view?
- How to filter the terms to a special custom taxonomy?
- 2 Different Taxonomy with Hierarchical Term Relationship
- GET Taxonomy ID
- How to change value in wp-include/taxonomy.php without exchanging the WordPress-core
- Non-Recursive get_term_children()
- Display yesterday’s last post’s Custom field from Unique terms of one Taxonomies
- 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
- Echo used hierarchical taxonomies parent name
- Order taxonomy terms by the frequency of use in the last 30 days
- Why can’t I exclude a term ID from either get_terms or WP_Term_query?
- Can One Taxonomies Terms be Ordered by A Seperate Taxonomy?
- Unable to do WP_User_Query with meta filter
- get_terms of specific parent (including the parent itself)
- Custom Titles for Multiple Tag Taxonomy Page