Support

Account

Home Forums General Issues Extending Tags

Solving

Extending Tags

  • Hi all,

    I have added field to tags using ACF. I have then create a new separate taxonomy field so that I can select a preferred tag.

    From the post, I can get the preferred tag id. What I am struggling with is getting the fields from a tag where I know the tag_id.

    Looking at the database, I can see that I want the data from wp_termdata using term_id

    Can I get this data using ACF functions or do I need to use WP functions?

    Thanks

  • This is my problem, that article is around getting tag fields from a post.

    I don’t want to do that.

    I want to get all of the fields associated with a tag by tag_id

  • this code in the article gets fields from the term

    
    $image = get_field('image', $term);
    

    Get the taxonomy field

    
    $terms = get_field('taxonomy_field');
    foreach ($terms as $term) {
      // tax field returs IDs, use this
      $some_value = get_field('some_field', 'term_'.$term);
      // tax field returns term objects. use this
      $some_value = get_field('some_field', $term);
    }
    
Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.