phprockers-logo

Get current custom post type in wordpress

We can get easily custom post type or normal post type in wordpress by using the post id.
global $posts;
$post_id = $posts->ID;
$post_type = get_post_type($post_id);
echo $post_type;

0 comments:

Post a Comment