class WP_Screen {}

Core class used to implement an admin screen API.

More Information

Role of WP_Screen

This is a concrete class that is instantiated in the WordPress $screen global. It is primarily used to create and customize WordPress admin screens (as of WordPress 3.3).

Properties

Note: Please refer source code for the complete list of properties.

Public Properties

The following properties are built into the WP_Screen class.

$action
Any action associated with the screen. 'add' for *-add.php and *-new.php screens. Empty otherwise.
$base
The base type of the screen. This is typically the same as $id but with any post types and taxonomies stripped. For example, for an $id of 'edit-post' the base is 'edit'.
$id
The unique ID of the screen.
$is_network
Whether the screen is in the network admin.
$is_user
Whether the screen is in the user admin.
$parent_base
The base menu parent. This is derived from $parent_file by removing the query string and any .php extension. $parent_file values of 'edit.php?post_type=page' and 'edit.php?post_type=post' have a $parent_base of 'edit'.
$parent_file
The $parent_file for the screen per the admin menu system. Some $parent_file values are 'edit.php?post_type=page', 'edit.php', and 'options-general.php'.
$post_type
The post type associated with the screen, if any. The 'edit.php?post_type=page' screen has a post type of 'page'. The 'edit-tags.php?taxonomy=$taxonomy&post_type=page' screen has a post type of 'page'.
$taxonomy
The taxonomy associated with the screen, if any. The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'.

Private Properties

The following properties are built into the WP_Screen class.

$_help_tabs
Private. The help tab data associated with the screen, if any.
$_help_sidebar
Private. The help sidebar data associated with screen, if any.
$_old_compat_help
Private. Stores old string-based help.
$_options
Private. The screen options associated with screen, if any.
$_registry
Private. The screen object registry.
$_show_screen_options
Private. Stores the result of the public show_screen_options() function.
$_screen_settings
Private. Stores the 'screen_settings' section of screen options.

Methods

NameDescription
WP_Screen::__constructConstructor
WP_Screen::add_help_tabAdds a help tab to the contextual help for the screen.
WP_Screen::add_old_compat_helpSets the old string-based contextual help for the screen for backward compatibility.
WP_Screen::add_optionAdds an option for the screen.
WP_Screen::getFetches a screen object.
WP_Screen::get_columnsGets the number of layout columns the user has selected.
WP_Screen::get_help_sidebarGets the content from a contextual help sidebar.
WP_Screen::get_help_tabGets the arguments for a help tab.
WP_Screen::get_help_tabsGets the help tabs registered for the screen.
WP_Screen::get_optionGets the arguments for an option for the screen.
WP_Screen::get_optionsGets the options registered for the screen.
WP_Screen::get_screen_reader_contentGets the accessible hidden headings and text used in the screen.
WP_Screen::get_screen_reader_textGets a screen reader text string.
WP_Screen::in_adminIndicates whether the screen is in a particular admin.
WP_Screen::is_block_editorSets or returns whether the block editor is loading on the current screen.
WP_Screen::remove_help_tabRemoves a help tab from the contextual help for the screen.
WP_Screen::remove_help_tabsRemoves all help tabs from the contextual help for the screen.
WP_Screen::remove_optionRemoves an option from the screen.
WP_Screen::remove_optionsRemoves all options from the screen.
WP_Screen::remove_screen_reader_contentRemoves all the accessible hidden headings and text for the screen.
WP_Screen::render_list_table_columns_preferencesRenders the list table columns preferences.
WP_Screen::render_meta_boxes_preferencesRenders the meta boxes preferences.
WP_Screen::render_per_page_optionsRenders the items per page option.