how to get post type name in wordpress code example
Example 1: wordpress get post type
// Retrieves the post type of the current post or of a given post.
get_post_type( int|WP_Post|null $post = null )
Example 2: get name custom post type wordpress
$pt = get_post_type_object( 'books' );
// These two usually contain the post type name in plural.
// They may differ though.
echo $pt->label;
echo $pt->labels->name;
// This one holds the post type name in singular.
echo $pt->labels->singular_name;