Title: term_meta custom fields
Last modified: October 9, 2016

---

# term_meta custom fields

 *  Resolved [alexadark](https://wordpress.org/support/users/alexadark/)
 * (@alexadark)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/term_meta-custom-fields/)
 * Hi,
    i am trying to have an image on custom taxonomy archive pages so i create
   the custom field
 *     ```
       Container::make('term_meta', 'Menus Images')
                ->show_on_taxonomy('menus')
                ->add_fields(array(
       	         Field::make('image', 'crb_hero_tax_image',__('Hero Image',CHILD_TEXT_DOMAIN)),
                ));
       ```
   
 *  but to retrieve it i don’t know what to write in place of $term
 * `$image_id = carbon_get_term_meta($term->term_id,'crb_hero_tax_image');`

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

 *  Thread Starter [alexadark](https://wordpress.org/support/users/alexadark/)
 * (@alexadark)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/term_meta-custom-fields/#post-8270843)
 * Hi,
    i have found the solution, and created a function to make it easier if it
   can be integrated into carbon fields it would be great
 *     ```
       function carbon_get_the_term_meta( $taxonomy = 'category', $field_name ) {
       	$term = get_query_var( $taxonomy );
       	$term = get_term_by( 'slug', $term, $taxonomy );
       	return carbon_get_term_meta( $term->term_id, $field_name );
       }
       ```
   
 *  Plugin Author [htmlBurger](https://wordpress.org/support/users/htmlburger/)
 * (@htmlburger)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/term_meta-custom-fields/#post-8274563)
 * Hi [@alexadark](https://wordpress.org/support/users/alexadark/),
 * Here is a simpler solution to fetch the meta value for the currently queried 
   term:
 * `carbon_get_term_meta( get_queried_object_id(), 'crb_hero_tax_image' );`
 * Function Reference: [get_queried_object_id()](https://developer.wordpress.org/reference/functions/get_queried_object_id/)
    -  This reply was modified 9 years, 8 months ago by [htmlBurger](https://wordpress.org/support/users/htmlburger/).
 *  Thread Starter [alexadark](https://wordpress.org/support/users/alexadark/)
 * (@alexadark)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/term_meta-custom-fields/#post-8282533)
 * Great!
    Thank you you should have this type of things in the doc, it would be
   super usefull

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

The topic ‘term_meta custom fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/carbon-fields_cacbcc.svg)
 * [Carbon Fields](https://wordpress.org/plugins/carbon-fields/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/carbon-fields/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/carbon-fields/)
 * [Active Topics](https://wordpress.org/support/plugin/carbon-fields/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/carbon-fields/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/carbon-fields/reviews/)

## Tags

 * [term_meta](https://wordpress.org/support/topic-tag/term_meta/)

 * 3 replies
 * 2 participants
 * Last reply from: [alexadark](https://wordpress.org/support/users/alexadark/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/term_meta-custom-fields/#post-8282533)
 * Status: resolved