Changeset 19428

Move convert_to_screen() back to template.php to avoid fatal errors with plugins and themes that direct include template.php into the front end. Flag this bad behavior with _doing_it_wrong(). Props nacin. fixes #19342

* @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.

1806

* @return WP_Screen Screen object.

1807

*/

1808

function convert_to_screen( $hook_name ) {

1809

if ( ! is_admin() ) {

1810

_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' );