From 572dcb62050a23eb861f63f9e824f9f9ecefca61 Mon Sep 17 00:00:00 2001 From: nacin Date: Fri, 25 Nov 2011 05:15:28 +0000 Subject: [PATCH] Use class_exists() rather than is_admin() as otherwise the unit tests won't work without a WP_ADMIN hack. see #19342. git-svn-id: http://svn.automattic.com/wordpress/trunk@19450 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-admin/includes/template.php b/wp-admin/includes/template.php index 06da772d6d..61d7465a6e 100644 --- a/wp-admin/includes/template.php +++ b/wp-admin/includes/template.php @@ -1806,7 +1806,7 @@ add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scr * @return WP_Screen Screen object. */ function convert_to_screen( $hook_name ) { - if ( ! is_admin() ) { + if ( ! class_exists( 'WP_Screen' ) ) { _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' ); }