W3cubDocs

/WordPress

get_current_screen(): WP_Screen|null

Get the current screen object

Return

WP_Screen|null Current screen object or null when screen not defined.

Source

function get_current_screen() {
	global $current_screen;

	if ( ! isset( $current_screen ) ) {
		return null;
	}

	return $current_screen;
}

Changelog

Version Description
3.1.0 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_current_screen