How to get tags with custom taxonomy field?

admin2025-06-04  47

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().

Share Improve this question edited Jan 9, 2019 at 6:47 fuxia 107k39 gold badges255 silver badges461 bronze badges asked Jan 9, 2019 at 6:05 KrunalKrunal 101 1
  • No, I’m afraid. get_tags gets only tags, not its meta... – Krzysiek Dróżdż Commented Jan 9, 2019 at 7:31
Add a comment  | 

1 Answer 1

Reset to default -1

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

<?php foreach($tags as $tag): ?>
    <span class="tag-element">
        <?=$tag->name ?>,
    </span>
<?php endforeach; ?>
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749029591a315762.html

最新回复(0)