convert_to_screen( string $hook_name )

Convert a screen string to a screen object

Parameters Parameters


(string) (Required) The hook name (also known as the hook suffix) used to determine the screen.

Top ↑

Return Return

(WP_Screen) Screen object.

Top ↑

Source Source

File: wp-admin/includes/template.php

function convert_to_screen( $hook_name ) {
	if ( ! class_exists( 'WP_Screen' ) ) {
			'convert_to_screen(), add_meta_box()',
				/* translators: 1: wp-admin/includes/template.php, 2: add_meta_box(), 3: add_meta_boxes */
				__( 'Likely direct inclusion of %1$s in order to use %2$s. This is very wrong. Hook the %2$s call into the %3$s action instead.' ),
		return (object) array(
			'id'   => '_invalid',
			'base' => '_are_belong_to_us',

	return WP_Screen::get( $hook_name );

Top ↑

Changelog Changelog

Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.