Display metabox title for custom fields with values
You can add another simple foreach loop to check if you have any values first: foreach ( $meta_boxes as $metabox ) { $has_value = false foreach ( $metabox[‘fields’] as $field ) { $meta = get_post_meta($post->ID, $field[‘id’], true); if(!isset($meta[0])){ $need_title = true; break; } } if ($has_value){ echo $metabox[‘title’]; foreach ( $metabox[‘fields’] as $field ) { … Read more