WP_Screen
- Since
- 3.3.0
- Source
wp-admin/includes/class-wp-screen.php:15
Core class used to implement an admin screen API.
Compatibility
- WordPress
- since 3.3.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Hooks and filters fired · 14
Every hook that fires from inside WP_Screen, in the order it appears in the class, grouped by the method that fires it.
WP_Screen::get()
- apply_filters( replace_editor )filter line 312
WP_Screen::set_current_screen()
- do_action( current_screen )action line 424
WP_Screen::render_screen_meta()
- do_action( contextual_help_list )filter_deprecated line 802
- do_action( contextual_help )filter_deprecated line 822
- do_action( default_contextual_help )filter_deprecated line 841
- apply_filters( screen_layout_columns )filter line 943
WP_Screen::show_screen_options()
- apply_filters( screen_settings )filter line 1019
- apply_filters( screen_options_show_screen )filter line 1034
WP_Screen::render_per_page_options()
- apply_filters( comments_per_page )filter line 1258
- apply_filters( edit_categories_per_page )filter line 1261
- apply_filters( {$option} )filter line 1264
- apply_filters( edit_posts_per_page )filter line 1270
Properties · 20
$actionstringpublic- Any action associated with the screen.
$basestringpublic- The base type of the screen.
$columnsintprivate- The number of columns to display. Access with get_columns().
$idstringpublic- The unique ID of the screen.
$in_adminstringprotected- Which admin the screen is in. network | user | site | false
$is_networkboolpublic- Whether the screen is in the network admin.
$is_userboolpublic- Whether the screen is in the user admin.
$parent_basestring|nullpublic- The base menu parent.
$parent_filestring|nullpublic- The parent_file for the screen per the admin menu system.
$post_typestringpublic- The post type associated with the screen, if any.
$taxonomystringpublic- The taxonomy associated with the screen, if any.
$_help_tabsarrayprivate- The help tab data associated with the screen, if any.
$_help_sidebarstringprivate- The help sidebar data associated with screen, if any.
$_screen_reader_contentstring[]private- The accessible hidden headings and text associated with the screen, if any.
$_old_compat_helparrayprivate static- Stores old string-based help.
$_optionsarrayprivate- The screen options associated with screen, if any.
$_registryarrayprivate static- The screen object registry.
$_show_screen_optionsboolprivate- Stores the result of the public show_screen_options function.
$_screen_settingsstringprivate- Stores the 'screen_settings' section of screen options.
$is_block_editorboolpublic- Whether the screen is using the block editor.
Methods · 33
- get()Fetches a screen object.
- set_current_screen()Makes the screen object the current screen.
- __construct()Constructor
- in_admin()Indicates whether the screen is in a particular admin.
- is_block_editor()Sets or returns whether the block editor is loading on the current screen.
- add_old_compat_help()Sets the old string-based contextual help for the screen for backward compatibility.
- set_parentage()Sets the parent information for the screen.
- add_option()Adds an option for the screen.
- remove_option()Removes an option from the screen.
- remove_options()Removes all options from the screen.
- get_options()Gets the options registered for the screen.
- get_option()Gets the arguments for an option for the screen.
- get_help_tabs()Gets the help tabs registered for the screen.
- get_help_tab()Gets the arguments for a help tab.
- add_help_tab()Adds a help tab to the contextual help for the screen.
- remove_help_tab()Removes a help tab from the contextual help for the screen.
- remove_help_tabs()Removes all help tabs from the contextual help for the screen.
- get_help_sidebar()Gets the content from a contextual help sidebar.
- set_help_sidebar()Adds a sidebar to the contextual help for the screen.
- get_columns()Gets the number of layout columns the user has selected.
- get_screen_reader_content()Gets the accessible hidden headings and text used in the screen.
- get_screen_reader_text()Gets a screen reader text string.
- set_screen_reader_content()Adds accessible hidden headings and text for the screen.
- remove_screen_reader_content()Removes all the accessible hidden headings and text for the screen.
- render_screen_meta()Renders the screen's help section.
- show_screen_options()
- render_screen_options()Renders the screen options tab.
- render_meta_boxes_preferences()Renders the meta boxes preferences.
- render_list_table_columns_preferences()Renders the list table columns preferences.
- render_screen_layout()Renders the option for number of columns on the page.
- render_per_page_options()Renders the items per page option.
- render_view_mode()Renders the list table view mode preferences.
- render_screen_reader_content()Renders screen reader text.
Source code
#[AllowDynamicProperties]final class WP_Screen { /** * Any action associated with the screen. * * 'add' for *-add.php and *-new.php screens. Empty otherwise. * * @since 3.3.0 * @var string */ public $action; /** * 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'. * * @since 3.3.0 * @var string */ public $base; /** * The number of columns to display. Access with get_columns(). * * @since 3.4.0 * @var int */ private $columns = 0; /** * The unique ID of the screen. * * @since 3.3.0 * @var string */ public $id; /** * Which admin the screen is in. network | user | site | false * * @since 3.5.0 * @var string */ protected $in_admin; /** * Whether the screen is in the network admin. * * Deprecated. Use in_admin() instead. * * @since 3.3.0 * @deprecated 3.5.0 * @var bool */ public $is_network; /** * Whether the screen is in the user admin. * * Deprecated. Use in_admin() instead. * * @since 3.3.0 * @deprecated 3.5.0 * @var bool */ public $is_user; /** * 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'. * * @since 3.3.0 * @var string|null */ public $parent_base;Changelog
Introduced in 3.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-admin/includes/class-wp-screen.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.