Support » Plugin: Category Custom Fields » [Plugin: Category Custom Fields] quick function i wrote

  • 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;


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