WP_Customize_Widgets::get_post_value()protectedWP 3.9.0

Retrieves an unslashed post value or return a default.

{} It's a method of the class: WP_Customize_Widgets{}

No Hooks.

Return

Mixed. Unslashed post value or default value.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_post_value( $name, $default_value );
$name(string) (required)
Post value.
$default_value(mixed)
Default post value.
Default: null

Changelog

Since 3.9.0 Introduced.

Code of WP_Customize_Widgets::get_post_value() WP 6.0

protected function get_post_value( $name, $default_value = null ) {
	if ( ! isset( $_POST[ $name ] ) ) {
		return $default_value;
	}

	return wp_unslash( $_POST[ $name ] );
}