This is the solution to get post terms by taxonomy by shortcode:
/**
* Custom shortcode to get terms
*/
function ALC_post_terms_by_taxonomy( $atts ) {
global $post;
$taxonomyTerms = wp_get_post_terms( $post->ID, $atts['taxonomy'], 'orderby=name&hide_empty=0' );
$term_array = array();
foreach ($taxonomyTerms as $taxonomyTerm) {
$term_array[] = $taxonomyTerm->name;
}
return implode( ', ', $term_array );
}
add_shortcode('get_terms_by_taxonomy', 'ALC_post_terms_by_taxonomy');
And you can use it by this shortcode:
[get_terms_by_taxonomy taxonomy="taxonomyname"]
Related Posts:
- Change link in get_terms if there is only one post in the category
- Ordering get_terms with ACF not displaying all terms
- Using get_option() in JavaScript
- Shortcode empty attribute
- Using wp_editor in shortcode
- Why are you using add_action for shortcode?
- How to get URL param to shortcode?
- How can I put a wp_redirect into a shortcode?
- How to display the names of users from a specific group with a shortcode?
- shortcode for logo image
- Stop strip_shortcodes() stripping content inside shortcodes
- Using audio shortcode for .mp3 URLs with a query string
- Get multiple shortcode attribute values
- How do i link gallery thumbnails to different url’s using the wp native gallery?
- Why do_shortcode is not executing the shortcode in data-* html attributes?
- How to display some selected user meta data on a specific page with a shortcode?
- Gallery shortcode menu order fix no longer working on WordPress 4.0
- has_shortcode for content added after the content
- Shortcode displays only default attribute values
- Can a shortcode function this way
- Dynamically create shortcodes using add_shortcode and a callback
- Creating a Slider Shortcode Based on Nivo Slider
- Passing attributes to shortcode dynamically
- Stop parsing shortcodes
- WordPress auto adds p to shortcode parameters
- Why isn’t this youtube shortcode working?
- Gist shortcode is not working
- ShortCode and extra
- How to change page title (from a plugin) in twentytwentyone theme
- WordPress Code Standards and Working $link Parameters In Shortcode
- How to set Contact Form 7 fields default value using shortcode attribute? [closed]
- Display post metadata: “title, category, author, date” with shortcode
- shortcode javascript not working on custom template file inside theme folder
- Check if post has gallery images/media
- Stop auto formatting in shortcodes
- If you add a shortcode programmatically, but the code isn’t viewed on that request, is it still executed?
- Get URL Param Plugin and Inserting Result in Widget Code
- Add shortcode support to custom field
- Preserve shortcode content formatting
- Shortcode help: If no image entered take default
- How can I escape a section of my page which contains multiple shortcodes?
- shortcode to display post by category entered by user without plugin
- Reloading a Mediaelement audio player
- Adding Shortcode Values to wp_head
- How to change the output of gallery shortcode
- wp_list_pages shortcode jumps above previous content
- Shortcode attributes don’t appear?
- Shortcodes: closing shortcode not being processed
- Retrieving post excerpt as a shortcode
- Insert PHP code via shortcode?
- Div-Wrap with Functions.php in Childtheme using Shortcode!
- Trying to call dynamic content as a shortcode attribute
- What is the correct syntax to append a URL using a shortcode for an iframe?
- Shortcodes in RSS excerpts
- How to check if a post has any one of many shortcodes?
- enqueue script with get_shortcode_regex
- Use Contact Form 7 with Ajax
- Is it possible to add a shortcode’s content to a table?
- How to set a variable in a shortcode and reference it in another shortcode in the same post?
- How to get_post_meta in a shortcode in excerpt on archive pages
- WordPress upgrade adding additional quote marks to shortcode output
- Which file renders the “Edit Gallery” Settings page?
- using shortcodes in theme content
- How to: Simple Nested Shortcode [closed]
- Plugin renders in preview but shortcode shows when published
- How to process shortcode on post save and update only
- get_posts not working on homepage?
- How to turn this HTML code into a shortcode? (adding song lyrics and giving an id to a div)
- ACF repeater + group shortcode
- Custom shortcode skips every 2nd shortcode
- Global $post returns 2 objects for my shortcode
- Gutenberg Shortcode Chooser Block
- How to add pagination in Terms
- How to cache a custom API call?
- Shortcode custom query not passing value
- How to create custom variables in wordpress
- WordPress 5.1 and Syntax highlighter, problem with HTML encoded special characters
- the_excerpt displaying code inside style tag
- Onclick want to call shortcode in wordpress
- Working with Contact Form 7 pipes
- How to disable cache for the content returned by a shortcode
- Hide shortcodes content from the excerpt?
- How can I extract or parse data from post contents’ shortcodes into an array?
- Can we create a shorcode to move next page?
- Do embed shortcode on wordpress ajax request
- launch a shortcode from a link
- Only execute specific shortcodes
- short code output too early
- short code output too early
- About redundant code when I use shortcode to output the HTML from a variable
- how to show last 5 images from the one post gallery
- Add JavaScript in footer if shortcode used in page [duplicate]
- A number appears inside a div called wpb_wrapper, when I use a custom shortcode
- Enclose article’s body with default shortcode
- Help with Shortcode Functionality
- Shortcode with foreach
- How do write this type shortcode? [closed]
- Working with Shortcode, AJAX, Elementor
- How to exclude some cats from wp_list_categories using shortcut
- How can I create a shortcode that shows a list of categories on the single product page?