diff --git a/wp-admin/includes/screen.php b/wp-admin/includes/screen.php index 2a6173edc..fd6afb2d9 100644 --- a/wp-admin/includes/screen.php +++ b/wp-admin/includes/screen.php @@ -107,18 +107,6 @@ function get_hidden_meta_boxes( $screen ) { return apply_filters( 'hidden_meta_boxes', $hidden, $screen, $use_defaults ); } -/** - * Convert a screen string to a screen object - * - * @since 3.0.0 - * - * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen. - * @return WP_Screen Screen object. - */ -function convert_to_screen( $hook_name ) { - return WP_Screen::get( $hook_name ); -} - /** * Add contextual help text for a page. * diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 7705509b1..06da772d6 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1795,4 +1795,21 @@ final class WP_Internal_Pointers { } } -add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) ); \ No newline at end of file +add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) ); + +/** + * Convert a screen string to a screen object + * + * @since 3.0.0 + * + * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen. + * @return WP_Screen Screen object. + */ +function convert_to_screen( $hook_name ) { + if ( ! is_admin() ) { + _doing_it_wrong( 'convert_to_screen(), add_meta_box()', __( "Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead." ), '3.3' ); + return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' ); + } + + return WP_Screen::get( $hook_name ); +} \ No newline at end of file