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
- Tips for using WordPress as a CMS? [closed]
- Show a different number of posts per page depending on context (e.g., homepage, search, archive)
- How to get posts by content?
- How to make a list of companies’ information and display them to user, using custom post types and a custom taxonomy?
- WP get_permalink Return Wrong URL
- add_meta_box: Datepicker like the one for postdate?
- [Plugin: Posts 2 Posts] reciprocal connections
- post expire after x days
- Set attached to state
- Use plugin or custom post type for game score functionality
- Admin Dashboard with Custom Tab for Client
- Bulk Image Uploader to create new post from each image [closed]
- Security checking in meta_box save is reluctant?
- wordpress reusable content blocks
- Post query – show posts from specified day and month and whole years
- Support for simultaneous editing
- View Private Published Page with URL Code (no login required)
- Solutions to repost categories into multisite blogs?
- Display post lists in 2nd paragraph
- How to make a proper custom post type link
- WordPress display breadcrumbs using Yoast plugin [closed]
- Preg Match All doesn’t Allow echo first character for WordPress Taxonomy Tags
- Excerpts on category page
- External RSS feed to WordPress Portfolio
- How to Add multiple instance of meta box to custom post type
- Mq translate plugin custom post type issue
- WordPress metaboxes – textfield suggestion automatically populated
- Would Gutenberg be considered a PlugIn?
- pagination on data fetched using SQL query
- How do I publish portfolio items with a future date?
- How to use template_include hook with form submission?
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- Where Should i write the code for wordpress ajax voting?
- Post status doesn’t update to ‘future’ every time?
- Modify Posts from Custom_Post_Type within the plugin
- Grab ID from post from plugin and use it to create an object
- WP::is_main_query() Not Working
- How can I list custom post type categories of portfolio
- Hook Scripts and Styles in WordPress
- WordPress meta-box and checkbox-list
- how can authors to define custom pages?
- Custom Post Type, Custom Columns List
- Update existing post dates to random dates and time
- need click to clipboard button on my site
- Setting Author on CPT
- Preset custom fields
- Adding category base to url in custom post giving 404?
- Problem with checked box on wp car manager plugin
- How to echo a PHP Code After the Content
- WordPress Product Detail and catalog
- Identify if the_post hook is being called from the admin post list
- why my wordpress dont have toolbar like, plugin, themes and other?
- How to Save settings of custom tab product page in admin side in a database?
- Displaying friend’s posts only
- Hidden Some Setting on Post or Page [duplicate]
- Edit post meta direct from post.php?
- How to Arrange Support => Thumbnail
- Creating themes using the one Plugin (Toolkit)
- Posts are deleted everyday at night
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Enforce conditions only for draft posts using WyPiekacz, ignore pending and published posts
- Embedding BitBucket Code in Posting
- How to delete unnecessary custom post types in the UI
- WordPress show different custom post type
- Getting 400 Error in wordpress website
- How to provide page_template path in custom plugin using WordPress