meta_box_prefs

Prints the meta box preferences for screen meta.

Description

meta_box_prefs( (WP_Screen) $screen ); 

Parameters (1)

0. $screen (WP_Screen)
The screen.

Usage

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

Defined (1)

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

/wp-admin/includes/screen.php  
  1. function meta_box_prefs( $screen ) { 
  2. global $wp_meta_boxes; 
  3.  
  4. if ( is_string( $screen ) ) 
  5. $screen = convert_to_screen( $screen ); 
  6.  
  7. if ( empty($wp_meta_boxes[$screen->id]) ) 
  8. return; 
  9.  
  10. $hidden = get_hidden_meta_boxes($screen); 
  11.  
  12. foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) { 
  13. foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { 
  14. if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) { 
  15. continue; 
  16. foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) { 
  17. if ( false == $box || ! $box['title'] ) 
  18. continue; 
  19. // Submit box cannot be hidden 
  20. if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] ) 
  21. continue; 
  22.  
  23. $widget_title = $box['title']; 
  24.  
  25. if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) { 
  26. $widget_title = $box['args']['__widget_basename']; 
  27.  
  28. printf( 
  29. '<label for="%1$s-hide"><input class="hide-postbox-tog" name="%1$s-hide" type="checkbox" id="%1$s-hide" value="%1$s" %2$s />%3$s</label>',  
  30. esc_attr( $box['id'] ),  
  31. checked( in_array( $box['id'], $hidden ), false, false ),  
  32. $widget_title 
  33. );