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... Jan 9, 2019 at 7:31

1 Answer 1


Have you try $tags = wp_get_post_tags($post->ID); ?

<?php foreach($tags as $tag): ?>
    <span class="tag-element">
        <?=$tag->name ?>,
<?php endforeach; ?>
  • I want all tags not single tag
    – Krunal
    Jan 9, 2019 at 7:52
  • what about loop foreach on all elements?
    – Mariusz
    Jan 9, 2019 at 7:54
  • I edit my answer , look now
    – Mariusz
    Jan 9, 2019 at 7:55
  • But I have 4000 records so its fire 4000 queries so its not efficient. I want it with one query.
    – Krunal
    Jan 9, 2019 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.