Get post type on edit page


I am writing the backend for my theme and have 4 custom post types. I have registered them all and now I am writing the metaboxes and handlers.

My question is: in WordPress admin, is there a way of determining which custom post type you’re editing? i.e. lets say I have a custom post type of Testimonials, I click Add New and am presented with various fields. Is there a function in WordPress that will tell me what this post type is?

I’ve tried get_post_type(), but it returns nothing.

Steve Clark 11 years 2010-12-23T05:45:00-05:00 0 Answers 86 views 0

Leave an answer