Well, you echo
an object. Never just echo stuff if you are not sure what you get in return. Take a look at the function: The error itself is quite clear:
function get_term_link( $term, $taxonomy = '') {
global $wp_rewrite;
if ( !is_object($term) ) {
if ( is_int($term) ) {
$term = get_term($term, $taxonomy);
} else {
$term = get_term_by('slug', $term, $taxonomy);
}
}
if ( !is_object($term) )
$term = new WP_Error('invalid_term', __('Empty Term'));
You seem to not be getting an object in return, so possibly your $term->name
is wrong (or empty).
To test for an error use is_wp_error()
and to output the message:
$link = get_term_link( etc );
if ( is_wp_error( $link ) )
echo $link->get_error_message();
Then you should get proper output of what happened and should be able to fix it.
Related Posts:
- pre_get_posts with tax_query causes empty result
- Sort Custom Post Type Archive by Taxonomy Term [duplicate]
- How to group by taxonomy on Custom Post Type archive
- How to redirect custom post type archive to first term of associated taxonomy?
- How do I get WordPress URL rewrites into Sitemap?
- Custom Taxonomy template is not recognised
- How do I Use Multiple Loops with WP_Query?
- Get number of post who belongs in two taxonomies!
- How do I exclude posts from custom taxonomy from a custom post type archive?
- Automatically Give All Custom Post Types a Pre-Set Category [duplicate]
- Why isn’t the ‘no results’ being shown when a query returns no results?
- Reverse order of posts in a certain taxonomy archive?
- pre_get_posts post_meta event
- Template file renders on local install, not on web
- Need equivalent of single_term_slug
- is there a way of getting term children that only shows those from two taxonomies
- Main query disturb pre_get_post by category query
- How to show category list in WordPress
- Change the Page Title of the Archive Page for Portfolio Tags
- index.php Not Showing Custom Posts / Terms
- stdClass::$labels /wp-includes/general-template.php undefined
- Using post type archive page for taxonomy archive
- add_rewrite_rule pagination 404 error on page 4 and above
- Add custom display condition to Elementor Theme Builder for custom taxonomy children, grandchildren, and great-grandchildren
- WP REST API no longer supports filter param, so how do I get posts in a custom taxonomy?
- Include and Exclude Taxonomies From Archives & Feeds Using ‘pre_get_posts’
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Get value in custom field with taxonomy [closed]
- Get second level terms of custom taxonomy
- Modify Term Update Redirection
- How to get first post in a category of a custom taxonomy
- How to get the singular name of a custom taxonomy?
- Archive template for taxonomy terms
- pre_get_posts OR relation between taxonomy and author
- Custom Fields and performance
- Non-hierarchical custom taxonomy using checkboxes on edit-screen -> saving issue
- Dynamic page slug for Custom Taxonomies?
- show term description instead of list terms of custom taxonomy
- get_the_term_list without specific category
- Add Category Name to REST API
- Display the Terms from a Custom Taxonomy Assigned to a Post(inside the loop) in Hierarchial Order
- Edit post meta with checkboxes on front end
- drop-down list taxonomy problem
- How to display custom taxonomy in multiple columns?
- Custom taxonomy sort by term meta in admin columns
- Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]
- WordPress Custom Taxonomy – Volume / Issue – Unique Slug Issue
- How to show the entries in a custom taxonomy by author?
- Get Current Custom Taxonomy ID by Post ID
- Custom fields to taxonomy
- Correct way to insert taxonomies on page insert
- Custom post type templating problem
- Styling Taxonomy Terms Individually
- Get terms cross-taxonomy query
- Hide posts having children terms when display posts by category in edit.php
- How to have two different versions of a tag/category/taxonomy archive page?
- Rewrite Rule Working for all but one of the taxonomies created
- Get custom taxonomy for visual composer shortcode but not working?
- List of users inside custom taxonomy
- Multi-select field for Taxonomy can’t save the value
- How to Display a menu only if it has Posts in Custom Menu?
- how does the wordpress rest API work
- Taxonomy terms can still be added when only assign_terms capability has been granted
- Use an HTML Element To Filter Taxonomies In WP Search
- Why is flush_rewrite_rules mandatory after registering custom taxonomies?
- tax_query not working
- wp_query not resetting, last post hanging
- Set term on an attachment using wp_set_object_terms and want to display the full term text but it’s showing a slug instead
- custom taxonomy not showing in Gutenberg
- Can I add other Custom Taxonomy to my syntax (functions.php)
- how to get term id from current post type instead of name
- Show categories of custom post type and not all posts
- Display children category images
- Dropdown taxonomy lists in admin menu
- Is there a way to change select-list for new custom taxonomy?
- How to define %category% for custom taxonomies?
- How to Create Multi selection search Form using Default WordPress Category Terms, and Custom post Types Taxonomies Terms?
- How do I get the correct URL?
- Query all images with certain tag in media library using visual portfolio plugin
- See double taxonomy inputs in WP editor
- Problem with wp_list_category with custom taxomy
- Restructuring permalink with more than one taxonomies
- Restrict viewing of posts by category, user role
- Custom order of taxonomy using wp_get_object_terms and woocommerce_term_meta
- ajax drop down change second drop down data
- Redirect or Prevent Viewing of Custom Taxonomy’s Archives?
- Does a codex exist for creating meta boxes in taxonomy
- Display taxonomy term slugs
- Run next query based on first query’s term
- Get the original menu item name string instead of the label
- How to use tax_query other than by slug or id or solve custom taxonomy tags conflicts with pre-existing tags?
- Tax query array terms display out of order
- How to query posts that are not related to any term of a taxonomy?
- Function code problem
- Permalinks not working on MU network with domain mapping
- add_action with variable as a part of the $tag string
- Get custom taxonomy term url on archive page
- Add text in custom taxonomy
- How do I check if a post has a term with a particular ancestor/parent?
- Best approach of implementing multi-select/checkboxes for taxonomies?