add_screen_option() WordPress Function

The add_screen_option() function allows you to add new options to the screen options drop-down menu. This can be useful if you want to add new options to customize the display of your content. For example, you could add a new option to show or hide certain elements on the screen.

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

Register and configure an admin screen option


Parameters

$option

(string)(Required)An option name.

$args

(mixed)(Optional)Option-dependent arguments.

Default value: array()


Top ↑

Source

File: wp-admin/includes/screen.php

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

	if ( ! $current_screen ) {
		return;
	}

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


Top ↑

Changelog

Changelog
VersionDescription
3.1.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.