wp/wp-admin/includes/screen.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    13  *
    13  *
    14  * @param string|WP_Screen $screen The screen you want the headers for
    14  * @param string|WP_Screen $screen The screen you want the headers for
    15  * @return string[] The column header labels keyed by column ID.
    15  * @return string[] The column header labels keyed by column ID.
    16  */
    16  */
    17 function get_column_headers( $screen ) {
    17 function get_column_headers( $screen ) {
    18 	if ( is_string( $screen ) ) {
       
    19 		$screen = convert_to_screen( $screen );
       
    20 	}
       
    21 
       
    22 	static $column_headers = array();
    18 	static $column_headers = array();
       
    19 
       
    20 	if ( is_string( $screen ) ) {
       
    21 		$screen = convert_to_screen( $screen );
       
    22 	}
    23 
    23 
    24 	if ( ! isset( $column_headers[ $screen->id ] ) ) {
    24 	if ( ! isset( $column_headers[ $screen->id ] ) ) {
    25 		/**
    25 		/**
    26 		 * Filters the column headers for a list table on a specific screen.
    26 		 * Filters the column headers for a list table on a specific screen.
    27 		 *
    27 		 *
   109 	foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) {
   109 	foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) {
   110 		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
   110 		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
   111 			if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) {
   111 			if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) {
   112 				continue;
   112 				continue;
   113 			}
   113 			}
       
   114 
   114 			foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) {
   115 			foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) {
   115 				if ( false == $box || ! $box['title'] ) {
   116 				if ( false === $box || ! $box['title'] ) {
   116 					continue;
   117 					continue;
   117 				}
   118 				}
       
   119 
   118 				// Submit box cannot be hidden.
   120 				// Submit box cannot be hidden.
   119 				if ( 'submitdiv' === $box['id'] || 'linksubmitdiv' === $box['id'] ) {
   121 				if ( 'submitdiv' === $box['id'] || 'linksubmitdiv' === $box['id'] ) {
   120 					continue;
   122 					continue;
   121 				}
   123 				}
   122 
   124 
   157 	$use_defaults = ! is_array( $hidden );
   159 	$use_defaults = ! is_array( $hidden );
   158 
   160 
   159 	// Hide slug boxes by default.
   161 	// Hide slug boxes by default.
   160 	if ( $use_defaults ) {
   162 	if ( $use_defaults ) {
   161 		$hidden = array();
   163 		$hidden = array();
       
   164 
   162 		if ( 'post' === $screen->base ) {
   165 		if ( 'post' === $screen->base ) {
   163 			if ( in_array( $screen->post_type, array( 'post', 'page', 'attachment' ), true ) ) {
   166 			if ( in_array( $screen->post_type, array( 'post', 'page', 'attachment' ), true ) ) {
   164 				$hidden = array( 'slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv' );
   167 				$hidden = array( 'slugdiv', 'trackbacksdiv', 'postcustom', 'postexcerpt', 'commentstatusdiv', 'commentsdiv', 'authordiv', 'revisionsdiv' );
   165 			} else {
   168 			} else {
   166 				$hidden = array( 'slugdiv' );
   169 				$hidden = array( 'slugdiv' );