WP_Screen::get_option()publicWP 3.3.0

Gets the arguments for an option for the screen.

Method of the class: WP_Screen{}

No Hooks.

Return

String. The option value if set, null otherwise.

Usage

$WP_Screen = new WP_Screen();
$WP_Screen->get_option( $option, $key );
$option(string) (required)
Option name.
$key(string|false)
Specific array key for when the option is an array.
Default: false

Changelog

Since 3.3.0 Introduced.

WP_Screen::get_option() code WP 6.5.2

public function get_option( $option, $key = false ) {
	if ( ! isset( $this->_options[ $option ] ) ) {
		return null;
	}
	if ( $key ) {
		if ( isset( $this->_options[ $option ][ $key ] ) ) {
			return $this->_options[ $option ][ $key ];
		}
		return null;
	}
	return $this->_options[ $option ];
}