// First, get associated taxonomies of the post/object.
$object_taxonomies = get_object_taxonomies( get_post() );
// Next, get associated terms of the post/object.
$object_terms = wp_get_object_terms( get_the_ID(), $object_taxonomies );
$terms = array();
// returned object terms could be WP_Error, so check that first.
if( ! is_wp_error($object_terms) && is_array($object_terms) )
{
foreach( $object_terms as $object_term )
{
// get_term_link could return WP_Error as well, so validate
$link = get_term_link($object_term);
if( ! is_wp_error($link) ){
$terms[] = sprintf('<a href="https://wordpress.stackexchange.com/questions/180778/%s">%s</a>', $link, $object_term->name);
}
}
}
// Lastly, display
if( !empty($terms) ){
echo join(', ', $terms);
}
Related Posts:
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- Notice: Trying to get property ‘term_id’ of non-object
- How to remove plugin-specific custom taxonomy terms when plugin is uninstalled?
- term_exists() returning NULL on term that exists
- modify show UI of a registered taxonomy
- set a custom post type to a taxonomy term programmatically in metabox
- add_action priority and taxonomy used in plugin
- How to display custom taxonomy and terms using/creating plugin template
- If I want to create new taxonomies (e.g. Project / Documents / Etc…) is it better to create them in the theme’s functions.php or within a plugin? [duplicate]
- Extending theme PHP class in plugin
- How to access noticeOperations from withNotices
- How to hook a custom user function to a wordpress core ajax action?
- Elementor custom Query with ACF fields to show matching woocommerce products custom fields
- WP Gutenberg Blocks – How to limit first/root blocks
- $_FILES empty on created_{taxonomy} and create_{taxonomy} yet is is not on edit_{taxonomy}
- How to get boolean value from register_meta properly?
- what is the difference between these phares?
- Form doesnt save to database
- What is the proper method of using global $post?
- How developed with version control word press site on shared host? [closed]
- How to export post meta with images in wordpress
- Password field is empty when using wp_signon();
- How to change title tag at page after loaded post?
- Following WordPress Markup Is mandatory, got awkward resultyby wordpress standard markup?
- Why is the WordPress taxonomy not registering?
- How do I create plugin or theme using MVC pattern?
- How to limit number of number of categories displayed by categories widget
- Translate slug in WPMU with PO files
- PowerPress mobile media player
- When is the proper time to minify css and js with git workflow?
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- How to hide or rename “X” and “x-child” references in website source?
- WordPress custom taxonomy check box to dropdown
- Plugin templates vs Parent Theme
- Selectively update themes in WordPress multisite
- Ordering taxonomies by rank
- Widget HTML Display Problem
- How to create a backend for a custom theme?
- wp_nonce_field displaying twice
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- wp_get_post_terms Order by not working
- Plugin is not generating title tags on any pages or posts
- Is it necessary to do validation again when retrieving data from database?
- How to Control CSS of Admin On Creating only a Specific Custom Post Type
- Can’t change the style of a submit input type? [closed]
- Make a plugin page out of influence of the theme’s style
- Update Data parameter of a wp_localize_script() call
- Custom entity search and display
- WP Plugin Running before jQuery
- Template directory in plugin
- get_the_tags with separator control?
- How to only load css for used blocks on frontend
- 400 Bad Request, in wordpress theme development, wp_ajax
- Ajax is not working in a loop
- Add child pages to submenu automatically
- Taxonomies within plugin invalid
- Why in this archive page that call query_posts() function show only the last 10 posts?
- Let plugin check if taxonomy is already registered by another plugin
- my own SVN for a plugin/theme
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Why enqueue styles on hook?
- Getting a WordPress Debug Strategy
- unable to wp_enqueue_script(‘suggest’);
- Drawing the line between theme & plugin on large scale bespoke projects
- Apply styles to blockquote element with the WYSIWYG editor
- PHP File_exist() not working – Checking if File Exist in WordPress Theme Directory
- Why would you use esc_attr() on internal functions?
- Invalid hook call on save, not edit when using swiper slider
- Proper way to use useSelect
- Conditional Generation of Image Sizes using add_image_size
- How to add plugin options in wp editor page
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- How to find where an object first instantiatiation
- Gutenberg blocks error: Each child in a list should have a unique “key” prop
- Full documentation about $args for register_rest_route?
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- Non editable custom taxonomy
- how to get term id from current post type instead of name
- Using function from enqueued .js file in theme in plugin?
- How add default term meta to prevent an error?
- Does WordPress default CSS have Grids?
- How to create taxonomy without using register_taxonomy () function
- Using HTML links within translatable string
- How to resize WordPress images on upload to specific height and width without cropping it
- Add location tag to wordpress posts
- Create fixed static pages
- How to get terms for taxonomy
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- How to replace settings in WordPress plugin from a theme
- Save temporary registration data
- How to remove/replace current page template?
- WordPress dynamic widget by location?
- WordPress Page Reload Takes forever during theme development
- Adjust query on single
- Setting a post’s category
- rewrite_rules problem
- Using password protection to load different page elements?
- Anyone using unzip_file successfully? It uploads the zip but doesn’t extract it!
- How can the_excerpt (or equivalent) be called on a category description?
- Why does website stretch and white space on load? [duplicate]