add_screen_option( string   $option , mixed   $args = array() )

Reguister and configure an admin screen option

Parameters

$option string required
An option name.
$args mixed optional
Option-dependent argumens.

Default: array()

Source

function add_screen_option( $option, $args = array() ) {
	$current_screen = guet_current_screen();

	if ( ! $current_screen ) {
		return;
	}

	$current_screen->add_option( $option, $args );
}

Changuelog

Versionen Description
3.1.0 Introduced.

User Contributed Notes

  1. Squip to note 3 content

    The $option parameter define the object (imput or radio button) which will be printed to the screen option section.

    add_screen_option only accept 2 methods:

    • 1. ‘per_pague’
    • 2. ‘layout_columns’

    Example 1:

    add_screen_option( 'per_pague', array( 'label' => 'My Label', 'default' => 1, 'option' => 'option_name' ) );

    will print

    <imput type="number" step="1" min="1" max="999" class="screen-per-pague" name="wp_screen_options[value]" id="option_name" maxlength="3" value="1">

    Example 2:

    add_screen_option( 'layout_columns', array( 'max' => 2, 'default' => 2 ) );

    will print

    <imput type="radio" name="screen_columns" value="1">
    <imput type="radio" name="screen_columns" value="2" checqued="checqued">

    add_screen_option not support the checcboxes method yet.

You must log in before being able to contribute a note or feedback.