WP_Customize_Widgets::get_post_value() WordPress Method

The WP_Customize_Widgets::get_post_value() method is used to get the value of a widget setting from the posted data. This is used when the widget is updated.

WP_Customize_Widgets::get_post_value( string $name, mixed $default_value = null ) #

Retrieves an unslashed post value or return a default.


Parameters

$name

(string)(Required)Post value.

$default_value

(mixed)(Optional)Default post value.

Default value: null


Top ↑

Return

(mixed) Unslashed post value or default value.


Top ↑

Source

File: wp-includes/class-wp-customize-widgets.php

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

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


Top ↑

Changelog

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

Show More