$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>How to get tags with custom taxonomy field?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to get tags with custom taxonomy field?

matteradmin9PV0评论

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; ?>

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far