Title: [Plugin: Category Custom Fields] quick function i wrote
Last modified: August 20, 2016

---

# [Plugin: Category Custom Fields] quick function i wrote

 *  [alexeightsix](https://wordpress.org/support/users/alexeightsix/)
 * (@alexeightsix)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-category-custom-fields-quick-function-i-wrote-1/)
 * I wrote two very basic functions to make it easier to retrieve data, thought 
   i would share it if anyone wanted it. Might be duplicating the wheel here, not
   sure if the pre-made functions do this already. Only feature request I ask of
   the author is to be able to pre-define select menus with data, and use the wordpress
   image uploader api for image fields.
 * function get_cat_meta($id, $field_name) {
    global $wpdb; $query = “SELECT `field_value`
   FROM `wp_ccf_Value` WHERE `term_id` = ‘” . $id . “‘ AND `field_name` = ‘” . $
   field_name . “‘ “; $result = $wpdb->get_row($query); return $result->field_value;}
 * function get_all_meta($id) {
    global $wpdb; $query = “SELECT DISTINCT `field_name`
   FROM `wp_ccf_Value`“; $result = $wpdb->get_results($query); foreach ($result 
   as $value) { $slide[$value->field_name] = get_cat_meta($id, $value->field_name);}
   return $slide;
 * }
 * [http://wordpress.org/extend/plugins/categorycustomfields/](http://wordpress.org/extend/plugins/categorycustomfields/)

The topic ‘[Plugin: Category Custom Fields] quick function i wrote’ is closed to
new replies.

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

 * 0 replies
 * 1 participant
 * Last reply from: [alexeightsix](https://wordpress.org/support/users/alexeightsix/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-category-custom-fields-quick-function-i-wrote-1/)
 * Status: not a support question