Class WP_Screen

Description

A class representing the admin screen.

  • since: 3.3.0
  • access: public

Located in /wp-admin/includes/screen.php (line 218)


	
			
Variable Summary
string $action
string $base
string $id
string $in_admin
bool $is_user
string $parent_base
string $parent_file
string $post_type
string $taxonomy
Method Summary
static void add_old_compat_help (WP_Screen $screen, string $help)
static WP_Screen get ([string $hook_name = ''])
void add_help_tab (array $args)
void add_option (string $option, [mixed $args = array()])
int get_columns ()
string get_help_sidebar ()
array get_help_tab (string $id)
array get_help_tabs ()
void get_option (string $option, [mixed $key = false])
boolean in_admin ([string $admin = null])
void remove_help_tab (string $id)
void set_help_sidebar (string $content)
void set_parentage (string $parent_file)
Variables
string $action (line 226)

Any action associated with the screen. 'add' for *-add.php and *-new.php screens. Empty otherwise.

  • since: 3.3.0
  • access: public
string $base (line 236)

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
  • access: public
string $id (line 254)

The unique ID of the screen.

  • since: 3.3.0
  • access: public
string $in_admin (line 263)

Which admin the screen is in. network | user | site | false

  • since: 3.5.0
  • access: protected
bool $is_network (line 275)

Whether the screen is in the network admin.

Deprecated. Use in_admin() instead.

  • deprecated: 3.5.0
  • since: 3.3.0
  • access: public
bool $is_user (line 287)

Whether the screen is in the user admin.

Deprecated. Use in_admin() instead.

  • deprecated: 3.5.0
  • since: 3.3.0
  • access: public
string $parent_base (line 298)

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
  • access: public
string $parent_file (line 308)

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'.

  • since: 3.3.0
  • access: public
string $post_type (line 319)

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'.

  • since: 3.3.0
  • access: public
string $taxonomy (line 328)

The taxonomy associated with the screen, if any.

The 'edit-tags.php?taxonomy=category' screen has a taxonomy of 'category'.

  • since: 3.3.0
  • access: public
Methods
static method add_old_compat_help (line 599)

Sets the old string-based contextual help for the screen.

For backwards compatibility.

  • since: 3.3.0
static void add_old_compat_help (WP_Screen $screen, string $help)
  • WP_Screen $screen: A screen object.
  • string $help: Help text.
static method get (line 399)

Fetches a screen object.

  • return: Screen object.
  • since: 3.3.0
  • access: public
static WP_Screen get ([string $hook_name = ''])
  • string $hook_name: Optional. The hook name (also known as the hook suffix) used to determine the screen. Defaults to the current $hook_suffix global.
add_help_tab (line 687)

Add a help tab to the contextual help for the screen.

Call this on the load-$pagenow hook for the relevant screen.

  • since: 3.3.0
  • access: public
void add_help_tab (array $args)
  • array $args: - string - title - Title for the tab.
    • string - id - Tab ID. Must be HTML-safe.
    • string - content - Help tab content in plain text or HTML. Optional.
    • callback - callback - A callback to generate the tab content. Optional.
add_option (line 626)

Adds an option for the screen.

Call this in template files after admin.php is loaded and before admin-header.php is loaded to add screen options.

  • since: 3.3.0
  • access: public
void add_option (string $option, [mixed $args = array()])
  • string $option: Option ID
  • mixed $args: Option-dependent arguments.
get_columns (line 762)

Gets the number of layout columns the user has selected.

The layout_columns option controls the max number and default number of columns. This method returns the number of columns within that range selected by the user via Screen Options. If no selection has been made, the default provisioned in layout_columns is returned. If the screen does not support selecting the number of layout columns, 0 is returned.

  • return: Number of columns to display.
  • since: 3.4.0
  • access: public
int get_columns ()
get_help_sidebar (line 733)

Gets the content from a contextual help sidebar.

  • return: Contents of the help sidebar.
  • since: 3.4.0
  • access: public
string get_help_sidebar ()
get_help_tab (line 668)

Gets the arguments for a help tab.

  • return: Help tab arguments.
  • since: 3.4.0
  • access: public
array get_help_tab (string $id)
  • string $id: Help Tab ID.
get_help_tabs (line 656)

Gets the help tabs registered for the screen.

  • return: Help tabs with arguments.
  • since: 3.4.0
  • access: public
array get_help_tabs ()
get_option (line 638)

Gets the arguments for an option for the screen.

  • since: 3.3.0
  • access: public
void get_option (string $option, [mixed $key = false])
  • string $option: Option ID.
  • mixed $key: Optional. Specific array key for when the option is an array.
in_admin (line 582)

Indicates whether the screen is in a particular admin

  • return: True if the screen is in the indicated admin, false otherwise.
  • since: 3.5.0
  • access: public
boolean in_admin ([string $admin = null])
  • string $admin: The admin to check against (network | user | site). If empty any of the three admins will result in true.
remove_help_tab (line 713)

Removes a help tab from the contextual help for the screen.

  • since: 3.3.0
  • access: public
void remove_help_tab (string $id)
  • string $id: The help tab ID.
remove_help_tabs (line 722)

Removes all help tabs from the contextual help for the screen.

  • since: 3.3.0
  • access: public
void remove_help_tabs ()
render_per_page_options (line 1073)

Render the items per page option

  • since: 3.3.0
void render_per_page_options ()
render_screen_layout (line 1044)

Render the option for number of columns on the page

  • since: 3.3.0
void render_screen_layout ()
render_screen_meta (line 773)

Render the screen's help section.

This will trigger the deprecated filters for backwards compatibility.

  • since: 3.3.0
  • access: public
void render_screen_meta ()
render_screen_options (line 934)

Render the screen options tab.

  • since: 3.3.0
  • access: public
void render_screen_options ()
set_current_screen (line 556)

Makes the screen object the current screen.

void set_current_screen ()
set_help_sidebar (line 745)

Add a sidebar to the contextual help for the screen.

Call this in template files after admin.php is loaded and before admin-header.php is loaded to add a sidebar to the contextual help.

  • since: 3.3.0
  • access: public
void set_help_sidebar (string $content)
  • string $content: Sidebar content in plain text or HTML.
set_parentage (line 611)

Set the parent information for the screen.

This is called in admin-header.php after the menu parent for the screen has been determined.

  • since: 3.3.0
void set_parentage (string $parent_file)
  • string $parent_file: The parent file of the screen. Typically the $parent_file global.
show_screen_options (line 901)
  • access: public
void show_screen_options ()

Documentation generated on Thu, 23 May 2013 23:19:00 +0000 by phpDocumentor 1.4.1