On this page
WP_Screen::render_meta_boxes_preferences()
Renders the meta boxes preferences.
Source
File: wp-admin/includes/class-wp-screen.php. View all references
public function render_meta_boxes_preferences() {
global $wp_meta_boxes;
if ( ! isset( $wp_meta_boxes[ $this->id ] ) ) {
return;
}
?>
<fieldset class="metabox-prefs">
<legend><?php _e( 'Screen elements' ); ?></legend>
<p>
<?php _e( 'Some screen elements can be shown or hidden by using the checkboxes.' ); ?>
<?php _e( 'They can be expanded and collapsed by clickling on their headings, and arranged by dragging their headings or by clicking on the up and down arrows.' ); ?>
</p>
<?php
meta_box_prefs( $this );
if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) {
if ( isset( $_GET['welcome'] ) ) {
$welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;
update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
} else {
$welcome_checked = (int) get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
if ( 2 === $welcome_checked && wp_get_current_user()->user_email !== get_option( 'admin_email' ) ) {
$welcome_checked = false;
}
}
echo '<label for="wp_welcome_panel-hide">';
echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />';
echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n";
}
?>
</fieldset>
<?php
}
Related
Uses
| Uses | Description |
|---|---|
| meta_box_prefs() wp-admin/includes/screen.php | Prints the meta box preferences for screen meta. |
| wp_get_current_user() wp-includes/pluggable.php | Retrieves the current user object. |
| checked() wp-includes/general-template.php | Outputs the HTML checked attribute. |
| has_action() wp-includes/plugin.php | Checks if any action has been registered for a hook. |
| update_user_meta() wp-includes/user.php | Updates user meta field based on user ID. |
| get_user_meta() wp-includes/user.php | Retrieves user meta field for a user. |
| current_user_can() wp-includes/capabilities.php | Returns whether the current user has the specified capability. |
| _e() wp-includes/l10n.php | Displays translated text. |
| _x() wp-includes/l10n.php | Retrieves translated string with gettext context. |
| get_option() wp-includes/option.php | Retrieves an option value based on an option name. |
| get_current_user_id() wp-includes/user.php | Gets the current user’s ID. |
Used By
| Used By | Description |
|---|---|
| WP_Screen::render_screen_options() wp-admin/includes/class-wp-screen.php | Renders the screen options tab. |
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_screen/render_meta_boxes_preferences