true]; $post_types = get_post_types($args, 'objects'); if (isset($post_types['attachment'])) { unset($post_types['attachment']); } $formatted_post_types = []; foreach ($post_types as $post_type) { array_push($formatted_post_types, [ 'name' => $post_type->name, 'label' => $post_type->labels->singular_name, 'value' => $post_type->name ] ); } return $formatted_post_types; } }