Whenever you need to get the post type for a given post, there are a couple of ways to do this:
- If you’re in the dashboard, then you can use `get_current_screen()` and then access the `id` property of the object that’s returned. You can read more about this in the Codex.
- If you’re on the front-end (or even in the dashboard, really), you can use `get_post_type`. This is also covered in the Codex.
But what if you want to grab the post type of the post that’s currently being edited on the client-side (read: via JavaScript)?



