Hi there-
BP Docs Tags are a custom taxonomy, so you’ll have to get the terms using custom taxonomy-friendly functions.
For instance, to get all the docs tags that exist:
$docs_tags = get_terms( 'bp_docs_tag' );
To get all the docs tags associated with a particular post:
$docs_tags = get_the_terms( int|object $post, 'bp_docs_tag' );
Read more:
https://developer.wordpress.org/reference/functions/get_terms/
https://developer.wordpress.org/reference/functions/get_the_terms/
Hello. Thank you for the anserw.
That works, but when I want to:
echo $docs_tags[0]['name'];
Then site is crashed
Try using:
$output = '';
$doc_tags = wp_get_object_terms( $post->ID, 'bp_docs_tag' );
foreach ($doc_tags as $tag_id => $tag) {
$output .= ( $tag->name ).', ';
}
echo $output;
Or something alike.
Cheers.
—
jjy
UPDATE: In short, use object referentiation instead of array index.
$tag->name instead of $tag[‘name’] … and check it out.