WP_Screen::get_option

Advertisement

Summery Summery

Gets the arguments for an option for the screen.

Syntax Syntax

WP_Screen::get_option( string $option, string $key = false )

Parameters Parameters

$option

(Required) Option name.

$key

(Optional) Specific array key for when the option is an array.

Default value: false

Return Return

(string) The option value if set, null otherwise.

Source Source

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

	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 ];
	}

Advertisement

Changelog Changelog

Changelog
Version Description
3.3.0 Introduced.

Advertisement

Leave a Reply