Meta Box
Support › General › Display Taxonomy Link from metabox
I followed the documentation and was able to create several custom post types, custom taxonomies and to add metaboxes to my post type.
One of the field i'm using is taxonomy. I'm able to display the taxonomy on my post, but it doesn't link to anything.
Here's my code:
$ptf = rwmb_meta( 'pub_type_field' ); echo $ptf->name;
What would be the normal way to display both the name of the taxonomy and the link to the archive page of the said tax? Thanks
Hi Vee Jay,
The rwmb_meta returns a term object, so if you echo $ptf->name, you output only its name.
rwmb_meta
$ptf->name
It's better to use:
rwmb_the_value( 'pub_type_field' );
Or:
$ptf = rwmb_meta( 'pub_type_field' ); printf( '<a href="%s">%s</a>', get_term_link( $ptf ), $ptf->name );