• The ‘Installation page shows this php code to put in your theme to display a meta field:

    if (function_exists('wp_get_terms_meta'))
    { 
      $MetaValue = wp_get_terms_meta($category_id, $meta_key ,true); 
      //where $category_id is 'category/term id' and $meta_key is 'meta key'
    } 
    
    //meta value for meta key $meta_key
    echo $metaValue; 

    There is a MISTAKE. The line ‘echo $metaValue;’ should have an uppecase M. So to fix this it should be:

    if (function_exists('wp_get_terms_meta'))
    { 
      $MetaValue = wp_get_terms_meta($category_id, $meta_key ,true); 
      //where $category_id is 'category/term id' and $meta_key is 'meta key'
    } 
    
    //meta value for meta key $meta_key
    echo $MetaValue;

    So if I make a new meta field for a category I call “Address” (and I don’t know what the category ID is) I would display the info using this code:

    if (function_exists('wp_get_terms_meta'))
    { 
      //$current_term->term_id will populate with whatever the term ID is for the page bing viewed.  Address is the name of the meta field I created.
      $MetaValue = wp_get_terms_meta($current_term->term_id, 'Address' ,true); 
    } 
    
    //meta value for meta key $meta_key
    echo $MetaValue;
  • The topic ‘Instructions to display field is wrong, here is the fix’ is closed to new replies.