<? php $args = array( 'public' => true, ); $post_types = get_post_types( $args, 'objects' ); ?> <select class="widefat" name="post_type"> <? php foreach ( $post_types as $post_type_obj ): $labels = get_post_type_labels( $post_type_obj ); ?> <option value="<?php echo esc_attr( $post_type_obj->name ); ?> "><?php echo esc_html( $labels->name ); ?></ option> <? php endforeach; ?> </select>