Get custom post type?
-
So I am currently trying to get the current post type in a class. Unfortunately it seems like due to me trying to get it in the construct it is not returning the correct value. I attempted the following but it is not doing it correctly. Have been unable to find how to do it in the construct.
$post_type = get_post_type($post->ID); if ($post_type == 'some_cpt') { //do something }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get custom post type?’ is closed to new replies.