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

---

# meta_box_prefs( WP_Screen $screen )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/meta_box_prefs/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/meta_box_prefs/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/meta_box_prefs/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/meta_box_prefs/?output_format=md#changelog)

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

Prints the meta box preferences for screen meta.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/meta_box_prefs/?output_format=md#parameters)󠁿

 `$screen`[WP_Screen](https://developer.wordpress.org/reference/classes/wp_screen/)
required

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

    ```php
    function meta_box_prefs( $screen ) {
    	global $wp_meta_boxes;

    	if ( is_string( $screen ) ) {
    		$screen = convert_to_screen( $screen );
    	}

    	if ( empty( $wp_meta_boxes[ $screen->id ] ) ) {
    		return;
    	}

    	$hidden = get_hidden_meta_boxes( $screen );

    	foreach ( array_keys( $wp_meta_boxes[ $screen->id ] ) as $context ) {
    		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
    			if ( ! isset( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] ) ) {
    				continue;
    			}

    			foreach ( $wp_meta_boxes[ $screen->id ][ $context ][ $priority ] as $box ) {
    				if ( false === $box || ! $box['title'] ) {
    					continue;
    				}

    				// Submit box cannot be hidden.
    				if ( 'submitdiv' === $box['id'] || 'linksubmitdiv' === $box['id'] ) {
    					continue;
    				}

    				$widget_title = $box['title'];

    				if ( is_array( $box['args'] ) && isset( $box['args']['__widget_basename'] ) ) {
    					$widget_title = $box['args']['__widget_basename'];
    				}

    				$is_hidden = in_array( $box['id'], $hidden, true );

    				printf(
    					'<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>',
    					esc_attr( $box['id'] ),
    					checked( $is_hidden, false, false ),
    					$widget_title
    				);
    			}
    		}
    	}
    }
    ```

[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#L96)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/screen.php#L96-L142)

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

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

Gets an array of IDs of hidden meta boxes.

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

Converts a screen string to a screen object.

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

Outputs the HTML checked attribute.

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

Escaping for HTML attributes.

  |

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

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

Renders the meta boxes preferences.

  |

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

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

## User Contributed Notes

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