get_current_screen() WordPress Function

The get_current_screen() function is used to get the current screen object in WordPress. This function is useful for retrieving information about the current screen, such as the screen id, base, post type, and taxonomy.

get_current_screen() #

Get the current screen object


Return

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


Top ↑

Source

File: wp-admin/includes/screen.php

function get_current_screen() {
	global $current_screen;

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

	return $current_screen;
}


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.