I have added custom taxonomy fields on tags but when I use get_tags()
it does not return custom field. Right now I am using get_term_meta()
for custom field but I have 4000 records of tags so when I fire the query to get tags it fires 4000 queries so any way to minimize it or get results in 1 query with get_tags()
.
I have added custom taxonomy fields on tags but when I use get_tags()
it does not return custom field. Right now I am using get_term_meta()
for custom field but I have 4000 records of tags so when I fire the query to get tags it fires 4000 queries so any way to minimize it or get results in 1 query with get_tags()
.
- No, I’m afraid. get_tags gets only tags, not its meta... – Krzysiek Dróżdż Commented Jan 9, 2019 at 7:31
1 Answer
Reset to default -1Have you try
$tags = wp_get_post_tags($post->ID);
?
<?php foreach($tags as $tag): ?>
<span class="tag-element">
<?=$tag->name ?>,
</span>
<?php endforeach; ?>