xxxxxxxxxx
// Retrieves the post type of the current post or of a given post.
get_post_type( int|WP_Post|null $post = null )
xxxxxxxxxx
// Get the current post object
$post = get_post();
// Retrieve the post type slug
$post_type = $post->post_type;
// Output the post type
echo "The post type is: " . $post_type;