I've been looking everywhere but can't find any way to make this works. I am using the Taxonomy Metadata plugin and I am trying to display the custom metadata created. For this I use: get_term_meta($term_id, 'my_metadata', TRUE);
. The problem is that I can't find a way to get the term_id. I am in a template page inside the loop. Here is what I have tried:
$term = get_term_by('name', 'name', 'custom_taxonomy');
$termid = $term->term_id;
$metadata = get_term_meta($termid, 'my_metadata', TRUE);
But it's not working, it just returns: Trying to get property of non-object
for the term_id.
Could you help me please?
Thank you!
get_term_by
isn't finding the term, either the name or the taxonomy you are passing is incorrect.