I'm trying to display a custom field value added to custom taxonomy on single custom post type. I have articles post type with custom taxonomy called issue. I used the code from Tax-Meta-Class to add custom field "publication date" to that taxonomy. For each issue I added a "publication date" value. To display the publication date of the child issue on each related single article I tried to use this code:
$object_terms = wp_get_object_terms( $post->ID, 'issue', array( 'fields' => 'all' ) );
if ( $object_terms ) {
foreach ( $object_terms as $term ) {
if ( $term->parent ) {
$t_id .= $term->term_id;
$res .= get_tax_meta($t_id,'publication_date');
}
}
echo $res;
}
But nothing is displayed. I also tried to use get_term_meta
instead of get_tax_meta
but got nothing.
If I added echo $t_id;
It displays the term ID which means that the code can correctly get the term ID but it fails to display the custom field value.
Any help please?
get_tax_meta()
andget_term_meta()
functions from?