Title: php code for custom field
Last modified: August 31, 2016

---

# php code for custom field

 *  Resolved [cjrussell](https://wordpress.org/support/users/cjrussell/)
 * (@cjrussell)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-code-for-custom-field/)
 * Hello, first of all, thank you for the plugin.
 * I am very new to php and would like some guidance from you.
 * I made a custom field for post tags called “video”. I simply want to call the
   field and display it based on the current page. What php code do I need to use?
   I have searched around for an answer, but nothing seems to be what I need.
 * I am currently successfully calling and displaying the tag description this way:
 * `<?php echo category_description( $category_id ); ?>`
 * How can I call this custom “video” field this way?
 * [https://wordpress.org/plugins/wp-custom-taxonomy-meta/](https://wordpress.org/plugins/wp-custom-taxonomy-meta/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [cjrussell](https://wordpress.org/support/users/cjrussell/)
 * (@cjrussell)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-code-for-custom-field/#post-7165582)
 *     ```
       <?php
       if (function_exists('get_all_wp_terms_meta'))
       {
       $arrayMetaList = get_all_wp_terms_meta($category_id);
       }
   
       // array all meta fields for category/term
       print_r($arrayMetaList);
       ?>
       ```
   
 * I have this inside the functions.php, now how do I display a particular field,
   like the “video” I referenced above?
 *  Thread Starter [cjrussell](https://wordpress.org/support/users/cjrussell/)
 * (@cjrussell)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-code-for-custom-field/#post-7165589)
 *     ```
       <?php
       if (function_exists('wp_get_terms_meta'))
       {
        $MetaValue = wp_get_terms_meta($category_id, 'video' ,true);
       }
       echo $metaValue;
       ?>
       ```
   
 * I have this inside the widget to display the “video” field. Still isn’t working.
 *  Plugin Author [Aftab Husain](https://wordpress.org/support/users/amu02aftab/)
 * (@amu02aftab)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-code-for-custom-field/#post-7165674)
 * Hi Cjrussell,
 * Thanks for choosing my plugin.
 * you can get value putting the below code in template page where you want fetch–
 * > <?php
   >  if (function_exists(‘wp_get_terms_meta’)) { $MetaValue = wp_get_terms_meta(
   > $category_id, ‘video’ ,true); } echo $metaValue; ?> **NOTE:** Be sure you are
   > passing correct **$category_id** in the above function.
 * Hope this will help.
 * If you are facing problem still you can mail me on amu02aftab at gmail com .
 * Thanks,
    Aftab

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘php code for custom field’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-custom-taxonomy-meta_4c878c.svg)
 * [Category and Taxonomy Meta Fields](https://wordpress.org/plugins/wp-custom-taxonomy-meta/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-custom-taxonomy-meta/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-custom-taxonomy-meta/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-custom-taxonomy-meta/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-custom-taxonomy-meta/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-custom-taxonomy-meta/reviews/)

 * 3 replies
 * 0 participants
 * Last reply from: [Aftab Husain](https://wordpress.org/support/users/amu02aftab/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/php-code-for-custom-field/#post-7165674)
 * Status: resolved