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
- Disable All In One SEO plugin for custom post type
- How to check if the post exists in any of the categories?
- Collaborative post submission [closed]
- Admin Dashboard with Custom Tab for Client
- CKEditor: Uncaught TypeError: switchEditors.switchto is not a functiononclick
- custom taxonomy and custom post type url conflict
- New post notification plugin [closed]
- Is there plugin to show recent posts from one website in the widget area of another?
- Bulk Image Uploader to create new post from each image [closed]
- How use %like% in sql statement wordpress
- Security checking in meta_box save is reluctant?
- Display comments of users on single page
- wordpress reusable content blocks
- Override plugin with functions.php
- Get the url of the full sized attachment image using post ID?
- Adding Plugin-specific Fields with wp_insert_post()?
- Adding Attachment Display Settings in custom media frame
- Should i delete the posts created by a plugin on uninstall?
- Output HTML only on individual post view
- Advanced Custom Fields
- Allow users mark posts as “complete”?
- Using the “Latest posts” feature on a different site
- Post query – show posts from specified day and month and whole years
- Execute a plugin only on post pages
- How can i list random post from multiple category?
- How does WP handle multiple matching rewrite rules?
- Support for simultaneous editing
- how do i remove posts from a WP_Query so the pagination is right?
- Saving Custom Post types and fields to a custom table
- How to get 1 or 2 specific posts on top of my wordpress blog?
- Is it possible to use WordPress as an online portfolio for text content? What kind of theme would I look for?
- Portfolio + Blog: multisite or plugin?
- Building a store locator with google maps
- Duplicate posts when posting nulls in records in phpMyAdmin [closed]
- How to make wp_enqueue_style and wp_enqueue_script work only on custom post type
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- View Private Published Page with URL Code (no login required)
- Not able to complete meta box save function and sanitization/validation
- With W3 Total Cache when I publish a post it does not appear in the homepage. Only if i purge all cache [closed]
- If post has custom field then display css-class
- The problem with WordPress Importer
- How to create user groups and allow custom posts and plugin modify/access to specific group?
- I want to extend the current themes’ single.php to display the meta fields of my CPT
- Cron job not firing
- Plugin custom post type – Internal server Error
- Exclude post by custom meta with pre_get_posts
- Solutions to repost categories into multisite blogs?
- 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 do I “get the next 10 posts after post_id == x”?
- Hiding posts – WP Hide Post not working
- Is it possible to create Custom Post plug-in?
- get_post_type() and WP_QUERY issue
- submit posts by unregistered users in wordpress
- Calendar Solution: Handling upcoming Dates with Posts?
- Is there an easy way to flag posts in the admin area?
- List taxonomy terms for post as checkboxes
- finding whether request is for post, and post id
- more types plugin – display all post of post type on page
- When using Simple Fields plugin, how do I pull the information out of the database to display on a page?
- Changing custom type name hides the posts
- Any built-in function to associate a post to category through a plugin?
- Save / Show multi line text in metabox
- How to hide some section in WordPress under Post
- Display post lists in 2nd paragraph