On this page
WP_Screen::render_screen_options( array $options = array() )
Renders the screen options tab.
Parameters
$optionsarray Optional-
Options for the tab.
wrapboolWhether the screen-options-wrap div will be included. Defaults to true.
Default:
array()
Source
File: wp-admin/includes/class-wp-screen.php. View all references
public function render_screen_options( $options = array() ) {
$options = wp_parse_args(
$options,
array(
'wrap' => true,
)
);
$wrapper_start = '';
$wrapper_end = '';
$form_start = '';
$form_end = '';
// Output optional wrapper.
if ( $options['wrap'] ) {
$wrapper_start = '<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="' . esc_attr__( 'Screen Options Tab' ) . '">';
$wrapper_end = '</div>';
}
// Don't output the form and nonce for the widgets accessibility mode links.
if ( 'widgets' !== $this->base ) {
$form_start = "\n<form id='adv-settings' method='post'>\n";
$form_end = "\n" . wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ) . "\n</form>\n";
}
echo $wrapper_start . $form_start;
$this->render_meta_boxes_preferences();
$this->render_list_table_columns_preferences();
$this->render_screen_layout();
$this->render_per_page_options();
$this->render_view_mode();
echo $this->_screen_settings;
/**
* Filters whether to show the Screen Options submit button.
*
* @since 4.4.0
*
* @param bool $show_button Whether to show Screen Options submit button.
* Default false.
* @param WP_Screen $screen Current WP_Screen instance.
*/
$show_button = apply_filters( 'screen_options_show_submit', false, $this );
if ( $show_button ) {
submit_button( __( 'Apply' ), 'primary', 'screen-options-apply', true );
}
echo $form_end . $wrapper_end;
}
Hooks
- apply_filters( 'screen_options_show_submit',
bool $show_button ,WP_Screen $screen ) -
Filters whether to show the Screen Options submit button.
Related
Uses
| Uses | Description |
|---|---|
| WP_Screen::render_meta_boxes_preferences() wp-admin/includes/class-wp-screen.php | Renders the meta boxes preferences. |
| WP_Screen::render_list_table_columns_preferences() wp-admin/includes/class-wp-screen.php | Renders the list table columns preferences. |
| WP_Screen::render_view_mode() wp-admin/includes/class-wp-screen.php | Renders the list table view mode preferences. |
| WP_Screen::render_screen_layout() wp-admin/includes/class-wp-screen.php | Renders the option for number of columns on the page. |
| WP_Screen::render_per_page_options() wp-admin/includes/class-wp-screen.php | Renders the items per page option. |
| submit_button() wp-admin/includes/template.php | Echoes a submit button, with provided text and appropriate class(es). |
| esc_attr__() wp-includes/l10n.php | Retrieves the translation of $text and escapes it for safe use in an attribute. |
| wp_nonce_field() wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| wp_parse_args() wp-includes/functions.php | Merges user defined arguments into defaults array. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| WP_Screen::render_screen_meta() wp-admin/includes/class-wp-screen.php | Renders the screen’s help section. |
Changelog
| Version | Description |
|---|---|
| 3.3.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_screen/render_screen_options