Keep in mind that the return value of get_the_terms()
can be of the type of
array|WP_Error
Your snippet should check if you get the correct type returned
$terms = get_the_terms( 0, 'product_tag' );
if (
! is_wp_error( $terms )
AND is_array( $terms )
AND ! empty( $terms )
)
{
foreach( $terms as $term )
printf(
'<a href="https://wordpress.stackexchange.com/questions/163332/%s" style="font-size: 8pt; margin-right:5px;">%s</a>',
esc_url( get_term_link( $term ) ),
$term
);
}
Related Posts:
- Show post tags in a widget
- Is there a way to add more tags to the tag cloud?
- Custom Tag Cloud widget missing tags
- Show tags selection similar to category selection in WordPress
- How to filter products using filter products by attribute widget and OR logic between different product attribute types?
- Is it possible to display tag cloud widget by category?
- displaying tags in a widget
- Making tags appear as an Unordered list instead of a ‘cloud’
- Trying to filter tag cloud args, but it removes the wrapper
- Jquery checkbox -show posts with checked tags
- Sorting Tag Cloud by Popularity
- Display current tag archive’s name and description in sidebar
- Change Widget that display posts from categories to tags
- How can I use the built in WordPress “browse link” functionality?
- Code for Recent Posts Widget
- Modifying the default search widget
- Prevent widgets removal
- Modify recent post sidebar to show post thumbs with out plugins
- How to build widget with arrays inside arrays?
- How do I save data from submitted form from widget
- Why Can’t wp_editor Be Used in a Custom Widget?
- How to use control_callback when creating a widget via functions.php or plugin?
- Disable default WordPress widgets in sidebar
- Updating to Version 4.5 bumped my “main sidebar” widget out of place
- How can I delete all inactive widgets?
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Call sidebar from a template
- Adding classes to dynamic sidebar
- Widget Area: Modify $param[‘xy’] from widget-$n
- Need help adding additional controls to a custom widget
- Why do none of my widgets have a title?
- WP Query for Posts (Products) in Specific Category that has 2 Specific Tags (*AND* both tags not *OR*)
- Where are widget configurations stored?
- Adding a widget to a string of HTML
- How to add a class to a link in text editor
- WordPress widget new instance creates content duplicates
- Pass variables from one widget to another widget
- Remove/Unregister or hide a widget added by a plugin
- How do I get the current tag out of a taxonomy?
- Check if widget is active
- Radio buttons in widget not saving
- How to check if a widget has no title
- AJAX Contact Form Issue
- Including PHP files doesn’t work outside of Localhost
- How do I add a widget from an Android phone?
- get_tags() return an empty array after added tags with wp_insert_term()
- Check if the current shortcode is being used in a widget
- How to create a widget that accepts html input?
- Widget changes in customizer ajax error to many options?
- How to Add TinyMCE to widget
- How can I get the first section of a page 100% width, while the rest will have a sidebar? [closed]
- Modify ‘Sizes’ Attribute for Images with Specific Class
- Issue understanding and using WordPress filters and actions
- Custom taxonomy widget in admin area
- How can I inject html after the [x]th widget inside a Sidebar? [duplicate]
- Tabs and Category Widget
- Grabbing how Many Posts by Month for a Dashboard Widget
- ‘is_author()’ logic in widget for author only
- wp_dropdown_pages in widget form
- Recent Comments from Specific Category Widget
- Different sidebars not changing
- How do I create a template page with a specific widget as the content?
- How to make widget appear conditionally
- How Migrate a Legacy Widget to block?
- Ampersand breaking Widget title
- How to store category and tags separatly on wordpress?
- Creating a dynamic class name in my custom widget
- Got a problem with a widget
- Widget control – putting a slideshow in the widget area
- Sort query_terms_list for post_tags alphabetically
- Extending the WordPress Recent Posts Widget
- delete widget upon uninstall
- How to paste widget to a specific page
- How do I find out which
- An archive widget, coming from nowhere on my posts and pages
- custom widget not saved to sidebar
- When editing in block editor, the post/article gets under the floating widgets
- Make widget with media upload repeatable
- Is it possible to dynamically output the name of the widgets?
- What is the difference between widget object and widget instance?
- Apply two different styles to Wiget Titles along with a decorative line
- How Can I Replicate & Register a Widget from the Child Theme
- Widget to embed youtube video
- Can I use wp_widget_rss_output to show my site’s feed in the dashboard?
- How to make featured area?
- Checking if widget has title not working
- wp_list_categories + widget
- How can I add widgets to the category page?
- Remove default WordPress widgets
- Can I add a widget to the of my site?
- How to show widget in frontend?
- Widget Development – Displaying dropdown content
- How do I stop out of stock items from appearing on my WooCommerce site when using the Layered Nav widget [closed]
- Single Widget Multi Sidebar
- An issue with register_sidebar and the admin interface
- page url in shortcode
- iframe/embed vid in text widget loads outside container and moves around when scrolling the page?
- Widget on home page displays wrong time compared to same widget on inside pages
- Widget logic not working
- Theme Widget Area Defaults