Support

Account

Home Forums Front-end Issues Unable to fetch value of Taxonomy Term Custom Field for a Category

Helping

Unable to fetch value of Taxonomy Term Custom Field for a Category

  • Hello,

    I have installed ACF plugin on my website http://www.naukrinama.com

    I created a field group for taxonomy terms type in which i have added a field called “english_category_url”.

    Now i am trying to fetch its value on my category page, but i am unable to do it.

    Below is the code which i am using for it :
    <?php
    $abcd = get_field(‘english_category_url’,td_global::$current_category_obj->cat_ID);
    echo $abcd; ?>

    This code is always returning an empty response.

    Please let me know how can I achieve my goal of fetching the field value for a category based on the category URL which a user has opened.

  • You need to also supply the taxonomy as part of the post id. Looking at your code that can probably be done like this

    
    <?php
    $abcd = get_field(
      'english_category_url',
       td_global::$current_category_obj->taxonomy.'_'.
                             td_global::$current_category_obj->cat_ID
    );
    echo $abcd; ?>
    
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Unable to fetch value of Taxonomy Term Custom Field for a Category’ is closed to new replies.