The current screen isn’t setup on the admin_init
hook. That’s why global $current_screen
and get_current_screen()
don’t work.
Every admin page has a load-something
hook that fires after the current screen is set up. Since you say this is for an events custom post type, you should use the load-post.php
hook. So you’re code would look like:
function disable_drag_metabox() {
if( 'events' === get_current_screen()->post_type ) {
wp_deregister_script( 'postbox' );
}
}
add_action( 'load-post.php', 'disable_drag_metabox' );
You can use the Query Monitor plugin to figure out what hooks fire on each page and in what order. It also does a lot of other cook stuff.
Related Posts:
- Creating an Image-Centric Custom Post Type?
- Correctly delete posts with meta and attachments [duplicate]
- Why are the comments disabled by default on my custom_post_types?
- Linking Two Post Types
- Custom Post Types on Category Pages
- Creating “static” taxonomies to choose from, inside custom post type?
- How do I filter the excerpt metabox description in admin?
- Setting up custom post type archives in WP3.1? Any luck?
- Best Way to Create a List of Musician Gigs in WordPress
- Get custom post type by category in a page template
- Associating an “author” with a custom taxonomy
- TV Show database – Best way for structuring it?
- Add custom field to media attachment image attribute in post editor
- Why is the »_builtin« parameter not advised in »register_post_type()« for custom post types?
- Removing Image Sizes for Custom Post Type
- How to add a select menu to this metabox code?
- Query posts by custom post type and custom taxonomy
- Having trouble with custom post type / meta box
- Error after deleting Custom Post Type with a function (no trash used)
- Post Ancestor and Child Post in Custom Post Type
- After deleting a post are terms, and custom meta deleted?
- Storing Custom Post Type Data in a Custom Table
- How to delete all posts from a custom post type?
- Structure for projects and clients
- Should I use Custom Post Types or something else
- Community and User Generated Content Website: Have been thinking about Drupal but leaning on WordPress heavily
- Related links – from other sites
- Extend the wp_get_archives output with ‘?post_type=foo’?
- Why is my custom loop not filtering correctly nor paginating?
- Custom post types with custom directories
- Saving repeated option values in a custom query
- Check Title Unique Or Not and If not error message and dont save
- How to customize admin posts based on the user who is logged in
- Custom Post Type | Fatal Error on register_post_type()
- How can I display custom post types under multiple views?
- apply filters only to specific post listing without check the url parameters
- Dynamically add / duplicate custom meta in custom post types
- How can I create a custom meta box to add an mp4 video to a page?
- Custom post type menu missing after 3.0b2 -> 3.1.2 upgrade
- Group posts by custom post type
- How to check post type (to include custom css)
- Plugin: register custom post types, child ready and performance best practices
- Display only one post each WEEK
- Define new user capability for custom post types?
- How to allow visitors to enter custom post type?
- delete_published_posts does not work
- How to handle paged param in post and custom-post-type?
- Cannot save CPT meta box
- non-hierarchical post type with hierarchical url structure
- How to add attributes to taxonomies that may be different from post to post?
- How does order=asc effect a wp_query (its acting pretty weird in a loop)
- How to sort posts in a custom post type by title in ascending order by default?
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- How can I have different content for different countries?
- List Categories (wp_terms) and count posts
- Get_the_terms restrict output
- How to insert data into meta box from another plugin?
- YOAST SEO won’t work on custom post type archive [closed]
- List All Custom Post Types Posts in Nav Menu Dynamically
- Display custom post type for specific user
- post_content is stripping HTML when adding a new post? [closed]
- WordPress Count posts within a custom post type
- Custom Post Types and Removing Slugs – should we do it?
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Custom Content Type with No Page View
- Custom post type tags not showing in search
- $wpdb is queried but results don’t show
- How to list posts by term (custom taxonomy)
- How to keep a record of changes to a custom field?
- How to create Custom image post?
- Custom Post Type Implementation
- Related “custom post type” using “custom taxonomy”
- How do I disable the built-in editor and automatically configure the properties of new pages?
- How to have multiple search result pages in wordpress with taxonomy terms listed
- How to limit the number of custom posts certain users can publish in WordPress using php script?
- Custom page for creating/editing custom post type
- What is WordPress Way to Add Content Blocks to Post and Reference them as Many to One Relationship?
- Set a Default CPT taxonomy by taxonomy id
- Displaying posts inside table having issues
- Automatic Set Category For A Custom Post Type
- Publish metabox postition?
- Need folder for CPT templates for eg: single-{post_type}.php
- Building Link List for Custom Tax
- In the admin, how can you list thumbnails instead of titles for a custom post type?
- WordPress deletes custom posts instead of trash them
- Permanent Custom Post Type
- creating a custom post template
- Cant edit custom post type in WordPress dashboard
- Advanced Custom Fields – Add Field to Specific Page [closed]
- Display all post types together
- Collection of fields in a single post
- Make title field multiline in the add new custom post page?
- What’s the best way to show custom post types? With page template it’s not perfect!
- Add Image field to CPT
- How to add custom column to Custom post page list?
- Page template with custom query instead of archive-xxx.php?
- show posts under custom post type with same autj
- Same slug for Custom Taxonomy archive and CPT archive – Rewrite rule not working
- is therer any wordpress function to retrieve a specific html element from post content
- How to display *block number* instead *date value* on WordPress posts?