Title: get_current_screen
Published: April 25, 2014
Last modified: May 20, 2026

---

# get_current_screen(): 󠀁[WP_Screen](https://developer.wordpress.org/reference/classes/wp_screen/)󠁿|null

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#wp--skip-link--target)

Get the current screen object

## 󠀁[Return](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#return)󠁿

 [WP_Screen](https://developer.wordpress.org/reference/classes/wp_screen/)|null 
Current screen object or null when screen not defined.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#source)󠁿

    ```php
    function get_current_screen() {
    	global $current_screen;

    	if ( ! $current_screen instanceof WP_Screen ) {
    		return null;
    	}

    	return $current_screen;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/screen.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-admin/includes/screen.php#L224)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/screen.php#L224-L232)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#related)󠁿

| Used by | Description | 
| [wp_options_connectors_wp_admin_enqueue_scripts()](https://developer.wordpress.org/reference/functions/wp_options_connectors_wp_admin_enqueue_scripts/)`wp-includes/build/pages/options-connectors/page-wp-admin.php` |

Enqueue scripts and styles for the options-connectors-wp-admin page.

  | 
| [wp_font_library_wp_admin_enqueue_scripts()](https://developer.wordpress.org/reference/functions/wp_font_library_wp_admin_enqueue_scripts/)`wp-includes/build/pages/font-library/page-wp-admin.php` |

Enqueue scripts and styles for the font-library-wp-admin page.

  | 
| [WP_Plugin_Dependencies::display_admin_notice_for_unmet_dependencies()](https://developer.wordpress.org/reference/classes/wp_plugin_dependencies/display_admin_notice_for_unmet_dependencies/)`wp-includes/class-wp-plugin-dependencies.php` |

Displays an admin notice if dependencies are not installed.

  | 
| [wp_global_styles_render_svg_filters()](https://developer.wordpress.org/reference/functions/wp_global_styles_render_svg_filters/)`wp-includes/deprecated.php` |

Renders the SVG filters supplied by theme.json.

  | 
| [WP_Site_Health::admin_body_class()](https://developer.wordpress.org/reference/classes/wp_site_health/admin_body_class/)`wp-admin/includes/class-wp-site-health.php` |

Adds a class to the body HTML tag.

  | 
| [WP_Site_Health::enqueue_scripts()](https://developer.wordpress.org/reference/classes/wp_site_health/enqueue_scripts/)`wp-admin/includes/class-wp-site-health.php` |

Enqueues the site health scripts.

  | 
| [WP_Privacy_Policy_Content::notice()](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/)`wp-admin/includes/class-wp-privacy-policy-content.php` |

Adds a notice with a link to the guide when editing the privacy policy page.

  | 
| [WP_Privacy_Policy_Content::policy_text_changed_notice()](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/policy_text_changed_notice/)`wp-admin/includes/class-wp-privacy-policy-content.php` |

Outputs a warning when some privacy info has changed.

  | 
| [_wp_privacy_settings_filter_draft_page_titles()](https://developer.wordpress.org/reference/functions/_wp_privacy_settings_filter_draft_page_titles/)`wp-admin/includes/misc.php` |

Appends ‘(Draft)’ to draft page titles in the privacy page dropdown so that unpublished content is obvious.

  | 
| [WP_Widget_Custom_HTML::add_help_text()](https://developer.wordpress.org/reference/classes/wp_widget_custom_html/add_help_text/)`wp-includes/widgets/class-wp-widget-custom-html.php` |

Add help text to widgets admin screen.

  | 
| [wp_ajax_search_install_plugins()](https://developer.wordpress.org/reference/functions/wp_ajax_search_install_plugins/)`wp-admin/includes/ajax-actions.php` |

Handles searching plugins to install via AJAX.

  | 
| [wp_ajax_search_plugins()](https://developer.wordpress.org/reference/functions/wp_ajax_search_plugins/)`wp-admin/includes/ajax-actions.php` |

Handles searching plugins via AJAX.

  | 
| [WP_Screen::render_view_mode()](https://developer.wordpress.org/reference/classes/wp_screen/render_view_mode/)`wp-admin/includes/class-wp-screen.php` |

Renders the list table view mode preferences.

  | 
| [WP_Screen::get()](https://developer.wordpress.org/reference/classes/wp_screen/get/)`wp-admin/includes/class-wp-screen.php` |

Fetches a screen object.

  | 
| [add_screen_option()](https://developer.wordpress.org/reference/functions/add_screen_option/)`wp-admin/includes/screen.php` |

Register and configure an admin screen option

  | 
| [screen_layout()](https://developer.wordpress.org/reference/functions/screen_layout/)`wp-admin/includes/deprecated.php` |

Returns the screen layout options.

  | 
| [screen_options()](https://developer.wordpress.org/reference/functions/screen_options/)`wp-admin/includes/deprecated.php` |

Returns the screen’s per-page options.

  | 
| [screen_meta()](https://developer.wordpress.org/reference/functions/screen_meta/)`wp-admin/includes/deprecated.php` |

Renders the screen’s help.

  | 
| [wp_plugin_update_row()](https://developer.wordpress.org/reference/functions/wp_plugin_update_row/)`wp-admin/includes/update.php` |

Displays update information for a plugin.

  | 
| [wp_add_dashboard_widget()](https://developer.wordpress.org/reference/functions/wp_add_dashboard_widget/)`wp-admin/includes/dashboard.php` |

Adds a new dashboard widget.

  | 
| [wp_dashboard()](https://developer.wordpress.org/reference/functions/wp_dashboard/)`wp-admin/includes/dashboard.php` |

Displays the dashboard.

  | 
| [wp_dashboard_setup()](https://developer.wordpress.org/reference/functions/wp_dashboard_setup/)`wp-admin/includes/dashboard.php` |

Registers dashboard widgets.

  | 
| [_get_list_table()](https://developer.wordpress.org/reference/functions/_get_list_table/)`wp-admin/includes/list-table.php` |

Fetches an instance of a [WP_List_Table](https://developer.wordpress.org/reference/classes/wp_list_table/) class.

  | 
| [iframe_header()](https://developer.wordpress.org/reference/functions/iframe_header/)`wp-admin/includes/template.php` |

Generic Iframe header for use with Thickbox.

  | 
| [add_meta_box()](https://developer.wordpress.org/reference/functions/add_meta_box/)`wp-admin/includes/template.php` |

Adds a meta box to one or more screens.

  | 
| [do_meta_boxes()](https://developer.wordpress.org/reference/functions/do_meta_boxes/)`wp-admin/includes/template.php` |

Meta-Box template function.

  | 
| [remove_meta_box()](https://developer.wordpress.org/reference/functions/remove_meta_box/)`wp-admin/includes/template.php` |

Removes a meta box from one or more screens.

  | 
| [do_accordion_sections()](https://developer.wordpress.org/reference/functions/do_accordion_sections/)`wp-admin/includes/template.php` |

Meta Box Accordion Template Function.

  | 
| [post_comment_meta_box()](https://developer.wordpress.org/reference/functions/post_comment_meta_box/)`wp-admin/includes/meta-boxes.php` |

Displays comments for post.

  | 
| [page_attributes_meta_box()](https://developer.wordpress.org/reference/functions/page_attributes_meta_box/)`wp-admin/includes/meta-boxes.php` |

Displays page attributes form fields.

  | 
| [Custom_Image_Header::help()](https://developer.wordpress.org/reference/classes/custom_image_header/help/)`wp-admin/includes/class-custom-image-header.php` |

Adds contextual help.

  | 
| [Custom_Background::admin_load()](https://developer.wordpress.org/reference/classes/custom_background/admin_load/)`wp-admin/includes/class-custom-background.php` |

Sets up the enqueue for the CSS & JavaScript files.

  | 
| [wp_auth_check_load()](https://developer.wordpress.org/reference/functions/wp_auth_check_load/)`wp-includes/functions.php` |

Loads the auth check for monitoring whether the user is still logged in.

  | 
| [wp_admin_bar_edit_menu()](https://developer.wordpress.org/reference/functions/wp_admin_bar_edit_menu/)`wp-includes/admin-bar.php` |

Provides an edit link for posts and terms.

  |

[Show 29 more](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 11 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-2304)
 2.    [Rami Yushuvaev](https://profiles.wordpress.org/ramiy/)  [  9 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-2304)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-2304)
     Vote results for this note: 20[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-2304)
 4.      ```javascript
         PAGE               $SCREEN_ID           FILE
         -----------------  -------------------  -----------------------
         Media Library      upload               upload.php
         Comments           edit-comments        edit-comments.php
         Tags               edit-post_tag        edit-tags.php
         Plugins            plugins              plugins.php
         Links              link-manager         link-manager.php
         Users              users                users.php
         Posts              edit-post            edit.php
         Pages              edit-page            edit.php
         Edit Site: Themes  site-themes-network  network/site-themes.php
         Themes             themes-network       network/themes
         Users              users-network        network/users
         Edit Site: Users   site-users-network   network/site-users
         Sites              sites-network        network/sites
         ```
     
 5.   * If you want to set the screen to the front page do this:
      *     ```php
            set_current_screen( 'front' );
            ```
        
      *  This could be useful in unit tests
      * [carlosenam](https://profiles.wordpress.org/carlosenam/) [6 years ago](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-3594)
 6.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D2304%23feedback-editor-2304)
 7.   [Skip to note 12 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-5424)
 8.    [Tim Nolte](https://profiles.wordpress.org/tnolte/)  [  5 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-5424)
 9.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-5424)
     Vote results for this note: 9[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-5424)
 10. Be aware the this function doesn’t always exist, something that [@ravanh](https://profiles.wordpress.org/ravanh/)
     had sort of eluded to. It isn’t loaded and available until after `admin_init` 
     has fired. It is advisable to check whether the function exists when using it 
     within any hooks in the even those hooks fire before that function is actually
     loaded and available to use.
 11.     ```php
             /**
              * Check whether the get_current_screen function exists
              * because it is loaded only after 'admin_init' hook.
              */
             if ( function_exists( 'get_current_screen' ) ) {
                 $current_screen = get_current_screen();
                 // Do your thing.
             }
         ```
     
 12.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D5424%23feedback-editor-5424)
 13.  [Skip to note 13 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-604)
 14.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-604)
 15. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-604)
     Vote results for this note: 6[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-604)
 16. Another Example:
 17.     ```php
         <?php
     
         add_action( 'current_screen', 'wpdocs_this_screen' );
     
         /**
          * Run code on the admin widgets page
          */
         function wpdocs_this_screen() {
             $currentScreen = get_current_screen();
             if( $currentScreen->id === "widgets" ) {
                 // Run some code, only on the admin widgets page
             }
         }
     
         ?>
         ```
     
 18.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D604%23feedback-editor-604)
 19.  [Skip to note 14 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-3881)
 20.   [Graeme Fulton](https://profiles.wordpress.org/graylien/)  [  6 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-3881)
 21. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-3881)
     Vote results for this note: 5[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-3881)
 22. I was trying to find out the name of the admin dashboard.
      You can find out the
     current screen name by dumping it:
 23.     ```php
         $my_current_screen = get_current_screen();
         var_dump( $my_current_screen->base );
         ```
     
 24. Using this, I found the dashboard screen is just called ‘dashboard’ 🤯, so I could
     then redirect to a different page like this:
 25.     ```php
         /**
          * Redirect specific admin page
          */
         add_action( 'current_screen', 'wpdocs_custom_redirect_admin_dashboard' );
     
         function wpdocs_custom_redirect_admin_dashboard() {
             if ( is_admin() ) {
                 $my_current_screen = get_current_screen();
     
                 if ( isset( $my_current_screen->base ) && 'dashboard' === $my_current_screen->base ) {
                     wp_redirect( admin_url().'?page=custom_dashboard' );
                     exit();
                 }
             }
         }
         ```
     
 26.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D3881%23feedback-editor-3881)
 27.  [Skip to note 15 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-3477)
 28.   [Jb Audras](https://profiles.wordpress.org/audrasjb/)  [  7 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-3477)
 29. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-3477)
     Vote results for this note: 4[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-3477)
 30. The fields returned are:
 31. `id` (string) The unique ID of the screen
      `action` (string) Any action associated
     with the screen. ‘add’ for *-new.php screens. Empty otherwise. `base` (string)
     The base type of the screen. For example, for a page ‘post-new.php’ the base is‘
     post’. `parent_base` (string) The base menu parent. This is derived from $parent_file
     by removing the query string and any .php extension. For example, parent_file 
     values of ‘edit.php?post_type=page’ and ‘edit.php?post_type=post’ have a parent_base
     of ‘edit’ `parent_file` (string) 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` (string) The post type associated with the
     screen, if any. For example, the ‘edit.php?post_type=page’ screen has a post type
     of ‘page’ `taxonomy` (string) The taxonomy associated with the screen, if any.
     For example, the ‘edit-tags.php?taxonomy=category’ screen has a taxonomy of ‘category’
 32. Returned object:
 33.     ```php
         WP_Screen Object
         (
             [action] => 
             [base] => post
             [id] => post
             [is_network] => 
             [is_user] => 
             [parent_base] => edit
             [parent_file] => edit.php
             [post_type] => post
             [taxonomy] => 
             ...
             (private fields)
         )
         ```
     
 34.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D3477%23feedback-editor-3477)
 35.  [Skip to note 16 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-3186)
 36.   [Rolf Allard van Hagen](https://profiles.wordpress.org/ravanh/)  [  7 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-3186)
 37. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-3186)
     Vote results for this note: 3[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-3186)
 38. Be aware that at the global `$current_screen` gets set relatively late, right 
     _after_ the `admin_init` has run. This is done with function `set_current_screen()`
     in template files like admin-header.php and admin.php or when processing admin
     ajax requests.
 39. Calling `set_current_screen()` yourself earlier will not help. Although `get_current_screen()`
     does not return _null_ anymore, the current screen object will not be populated
     with the correct properties, like `get_current_screen()->$id`, to work with.
 40. Use `get_current_screen()` at the `current_screen` hook or later.
 41.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D3186%23feedback-editor-3186)
 42.  [Skip to note 17 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-5327)
 43.   [Mansour JabinPour – منصور جبین پور](https://profiles.wordpress.org/mansourjabin/)
     [  5 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-5327)
 44. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-5327)
     Vote results for this note: 1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-5327)
 45. Note that this function only works in admin!
 46.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D5327%23feedback-editor-5327)
 47.  [Skip to note 18 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-7029)
 48.   [Narendra Sishodiya](https://profiles.wordpress.org/narenin/)  [  2 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-7029)
 49. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-7029)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-7029)
 50. This can be useful for conditionally executing code depending on which admin screen
     is currently being viewed.
 51.     ```php
         // Hook into the admin_head action to run your code in the admin area
         add_action( 'admin_head', 'wpdocs_admin_code' );
     
         function wpdocs_admin_code() {
             // Get the current screen object
             $current_screen = get_current_screen();
     
             // Check if the current screen is the dashboard
             if ( 'dashboard' === $current_screen->id ) {
                 // Execute your code for the dashboard screen
                 echo 'alert( "You are on the dashboard!" );';
             }
     
             // Check if the current screen is a post editing screen
             if ( 'post' === $current_screen->base ) {
                 // Execute your code for the post editing screen
                 echo 'alert( "You are editing a post!" );';
             }
     
             // Check for other screen IDs or bases as needed
             // For example, to check if it's a page editing screen:
             if ( 'page' === $current_screen->id ) {
                 // Execute your code for the page editing screen
                 echo 'alert( "You are editing a page!" );';
             }
     
             // More conditions can be added as needed
         }
         ```
     
 52.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D7029%23feedback-editor-7029)
 53.  [Skip to note 19 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-603)
 54.   [Codex](https://profiles.wordpress.org/codex/)  [  11 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-603)
 55. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-603)
     Vote results for this note: -1[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-603)
 56. **Default Usage**
      This example shows how you would add contextual help to an 
     admin page you’ve created with the `add_options_page()` function. Here, we assume
     that your admin page has a slug of `my_admin_page` and exists under the Options
     tab.
 57. The `get_current_screen()` function is used in this example.
 58.     ```php
         <?php 
         add_action('admin_menu', 'wpdocs_admin_add_page');
     
         /**
          * Add an admin page
          */
         function wpdocs_admin_add_page() {
         	global $wpdocs_admin_page;
         	$wpdocs_admin_page = add_options_page(__('Wpdocs Admin Page', 'wpdocs_textdomain'),
         		__('Wpdocs Admin Page', 'wpdocs_textdomain'),
         		'manage_options', 'wpdocs_textdomain', 'wpdocs_admin_page');
     
         	// Adds my_help_tab when my_admin_page loads
         	add_action('load-'.$wpdocs_admin_page, 'wpdocs_admin_add_help_tab');
         }
     
         /**
          * Add a contextual help tab to the Wpdocs Admin Page
          */
         function wpdocs_admin_add_help_tab () {
             global $wpdocs_admin_page;
             $screen = get_current_screen();
     
             /*
              * Check if current screen is Wpdocs Admin Page
              * Don't add help tab if it's not
              */
             if ( $screen->id != $wpdocs_admin_page )
                 return;
     
             // Add my_help_tab if current screen is My Admin Page
             $screen->add_help_tab( array(
                 'id' => 'wpdocs_help_tab',
                 'title' => __('Wpdocs Help Tab'),
                 'content' => '<p>'
         		. __( 'Descriptive content that will show in Wpdocs Help Tab body goes here.', 'wpdocs_textdomain' )
         		. '</p>',
             ) );
         }
         ?>
         ```
     
 59.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D603%23feedback-editor-603)
 60.  [Skip to note 20 content](https://developer.wordpress.org/reference/functions/get_current_screen/?output_format=md#comment-content-1984)
 61.   [Aurovrata Venet](https://profiles.wordpress.org/aurovrata/)  [  10 years ago  ](https://developer.wordpress.org/reference/functions/get_current_screen/#comment-1984)
 62. [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-1984)
     Vote results for this note: -2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%23comment-1984)
 63. This function is useful to figure out which screen you’re on in the Dashboard,
 64.     ```php
         add_action('trashed_post', 'trash_wpcrm_contact');
         function trash_wpcrm_contact($post_id){
             $screen = get_current_screen();
             if('wpcrm-contact' != $screen->post_type){ //this is not our custom post, so let's exit
               return;
             }
             ....
         }
         ```
     
 65. Another useful attribute of the [WP_Screen](https://developer.wordpress.org/reference/classes/wp_screen/)
     object returned by this function is the `$screen->base` attribute which is set
     to `'post'` for any custom post edit screen, and is set to `'edit'` for the custom
     post admin table page, which is very handy when loading custom css/scripts for
     additional function on those pages.
 66.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F%3Freplytocom%3D1984%23feedback-editor-1984)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fget_current_screen%2F)
before being able to contribute a note or feedback.