How to get all custom fields of any post type
Add the following code in the functions.php for acf function get_all_meta($type){ global $wpdb; $result = $wpdb->get_results($wpdb->prepare( “SELECT post_id,meta_key,meta_value FROM wp_posts,wp_postmeta WHERE post_type = %s AND wp_posts.ID = wp_postmeta.post_id”, $type ), ARRAY_A); return $result; } function acf(){ $options = array(); $acf = get_all_meta(‘acf’); foreach($acf as $key => $value){ $options[‘post_type’][$value[‘post_id’]][‘post_id’] = $value[‘post_id’]; $test = substr($value[‘meta_key’], 0, 6); … Read more