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.