public static function get_post_types() { $items = array(); // Get the post types. $post_types = get_post_types(array('public' => true), 'objects'); // Build the array. foreach ($post_types as $post_type) { $items[$post_type->name] = $post_type->labels->name; } return $items; }