WP_Screen::render_meta_boxes_preferences() WordPress Method

The WP_Screen::render_meta_boxes_preferences() method is used to render the preferences for meta boxes. This is used to display the settings for meta boxes on the screen.

WP_Screen::render_meta_boxes_preferences() #

Render the meta boxes preferences.


Source

File: wp-admin/includes/class-wp-screen.php

	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
	}


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.