get_current_screen

Get the current screen object.

Description

(WP_Screen|null) get_current_screen(); 

Returns (WP_Screen|null)

Current screen object or null when screen not defined.


Usage

  1. if ( !function_exists( 'get_current_screen' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/screen.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_current_screen(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/screen.php  
  1. function get_current_screen() { 
  2. global $current_screen; 
  3.  
  4. if ( ! isset( $current_screen ) ) 
  5. return null; 
  6.  
  7. return $current_screen;