get_column_headers

Get the column headers for a screen.

Description

(array) get_column_headers( (string|WP_Screen) $screen ); 

Returns (array)

Containing the headers in the format id => UI String

Parameters (1)

0. $screen (string|WP_Screen)
The screen you want the headers for

Usage

  1. if ( !function_exists( 'get_column_headers' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/screen.php'; 
  3.  
  4. // The screen you want the headers for 
  5. $screen = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = get_column_headers($screen); 
  9.  

Defined (1)

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

/wp-admin/includes/screen.php  
  1. function get_column_headers( $screen ) { 
  2. if ( is_string( $screen ) ) 
  3. $screen = convert_to_screen( $screen ); 
  4.  
  5. static $column_headers = array(); 
  6.  
  7. if ( ! isset( $column_headers[ $screen->id ] ) ) { 
  8.  
  9. /** 
  10. * Filters the column headers for a list table on a specific screen. 
  11. * The dynamic portion of the hook name, `$screen->id`, refers to the 
  12. * ID of a specific screen. For example, the screen ID for the Posts 
  13. * list table is edit-post, so the filter for that screen would be 
  14. * manage_edit-post_columns. 
  15. * @since 3.0.0 
  16. * @param array $columns An array of column headers. Default empty. 
  17. */ 
  18. $column_headers[ $screen->id ] = apply_filters( "manage_{$screen->id}_columns", array() ); 
  19.  
  20. return $column_headers[ $screen->id ];