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: https://develop.svn.wordpress.org/trunk@19450 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2011-11-25 05:15:28 +00:00
parent ed8feb2912
commit 36fa9fddd6
1 changed files with 1 additions and 1 deletions

View File

@ -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' );
}