WP_Screen::get_option
Gets the arguments for an option for the screen.
Method of the class: WP_Screen{}
No Hooks.
Returns
?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() WP Screen::get option code WP 7.0
public function get_option( $option, $key = false ) {
if ( ! isset( $this->_options[ $option ] ) ) {
return null;
}
if ( $key ) {
return $this->_options[ $option ][ $key ] ?? null;
}
return $this->_options[ $option ];
}