Why can’t you just globalize $post and then get the post type? e.g.
<?php
global $post;
$post_type = get_post_type( $post->ID );
?>
In what context are you placing this code? In a metabox callback, or what?
(Also: why are you using $_GET data?)
Related Posts:
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Enable comments for post with comments meta box removed
- Custom Post Type causes Page Not Found
- Plugin “Meta Box”: Implementing meta boxes in custom post type
- Is there a way to order posts and custom post types as one group?
- RW Meta Box ,Problem setting post title
- dynamically generating plugin syntax
- Accessing post’s meta data based on user’s click of a post
- Correct way to make meta box with more than one meta field secure
- All of my custom posttypes are 404’ing
- Matching Chapters to a Custom posts [closed]
- Redirect to another page using contact form 7? [closed]
- How to delete all trashed item in one-go
- Custom setup of wordpress comments that are displayed
- Adding custom meta boxes to specified custom post type
- posts from multiple post types in one slider
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- Custom Template for wordpress cpt plugin
- What hook can I use to modify custom post data before it is displayed on the page?
- Error Metabox Warning: call_user_func() expects parameter 1 to be a valid callback
- Is it possible to pin a post in second position from top
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- Adding custom post category to categories widget
- How to display the custom post related blog by category?
- WordPress hide post from custom post-type on a single page
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- WordPress CPT Url metabox collection
- My own metabox checkbox plugin only saves the last value I’ve checked
- Displaying image from a repeatable group
- How to add jquery to my custom post type wp plugin
- WordPress list child pages of custom post type
- Insert data in custom table during new post creation
- How can i do custom author list?
- How to export post tags from wordpress
- How to check if the post exists in any of the categories?
- How to get a variable number of posts per post type on the main loop?
- echo value from ‘select’ field type into page template using cmb2?
- WP_List_Table Inside Metabox Not Working on Submit
- Add metabox with media uploader in a custom post type [duplicate]
- Disallow a user to post in certain categories
- Creating Custom Meta Boxes on Plugin Option Page
- Add .html extension to custom post type taxonomies
- How to load a new template page according to a particular URL?
- How to get the custom page get_permalink?
- How WordPress autosave can save plugin fields?
- Saving Custom Post types and fields to a custom table
- Portfolio + Blog: multisite or plugin?
- Building a store locator with google maps
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- How to create user groups and allow custom posts and plugin modify/access to specific group?
- How can I create a custom shortcode that will return a custom post type by ID?
- How to enable qTranslate languages tabs in custom plugin page
- How can I make my metabox appear?
- Import Instagram post to WordPress blog post
- How to get all posts belongs to a user between a certain date
- How can I automatically download all images from all imported posts, place them on my new host, and replace all the links
- Article content navigator in wordpress like mbaskool website
- Getting a list of the published posts
- If post exists in the database – each time goes on `else`
- Edit part of a post
- WordPress Stats Plugin: Display Post Views [closed]
- How to search post titles with whole words only, but not the exact word only?
- Remove custom taxonomy name from the slug – Custom Post Type UI
- Help to Create a Simple Plugin to make a post
- submit two file input fields in the same form
- New posts are not showing up on my front page
- Randomize post (and page) IDs on generation
- Moving all wordpress posts from 50 websites to another website
- custom post type get_posts() function not work
- Create multiple posts when a custom post is created
- Cannot view Custom Post Type no matter what I try
- Powerpress upload a podcast without creating a post for it
- Failed to load resource: the server responded with a status of 500 () post.php
- Multiple useres editing specified content
- $_POST from a Meta Box
- How to upload PDF from Front-End and post automatically?
- Get value from an input field and pass into update_meta_data as $meta_value
- Get content and send to 3rd party
- Do something with thumbnail image on post publish
- How can I remove this sidebar from my Search Results page?
- Is it possible to get a shortcode generated by a plugin, then, using a function, create a new post using that shortcode?
- Different email notifications (about pending posts) to different users
- How to display single arbitrary facebook post with a shortcode?
- Custom post type request switches to media request
- How to Batch Upload .docx Files as Posts
- Custom Post type plugin breaking the front page shows dashboard?
- WordPress ultra slow if I click on posts?
- wp_update_post does not change post status from draft to publish, returns 1
- Static page with formatted post list
- Automatically put a menu on every post
- Preset categories in wordpress by GET-paremters [duplicate]
- hide particular category post from front page only [closed]
- Filter custom post type returned from REST api
- Redirect a specific User role not admins automatically to view the post that they just updated
- warning wp session
- How to add portfolio category post count in main navigation menu?
- What is the easiest way to create a custom field archive?
- How to include Font Awesome icons into ‘menu_icon’ from register_post_type() function – wp admin?
- Load a custom post type template.html from a plugin
- How to make a page setting translatable in theme?