/** * Hash all fields into an indexed array for search * @param string $post_type Post type */ public static function hash_fields($post_type) { self::$fields[$post_type] = array(); $meta_boxes = SWPMB_Core::get_meta_boxes(); foreach ($meta_boxes as $meta_box) { $meta_box = SWP_Meta_Box::normalize($meta_box); if (!in_array($post_type, $meta_box['post_types'])) { continue; } foreach ($meta_box['fields'] as $field) { if (!empty($field['id'])) { self::$fields[$post_type][$field['id']] = $field; } } } }