WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Customize_Manager::post_value() public WP 3.4.0

Returns the sanitized value for a given setting from the current customized state.

The name "post_value" is a carry-over from when the customized state was exclusively sourced from $_POST['customized']. Nevertheless, the value returned will come from the current changeset post and from the incoming post data.

{} Это метод класса: WP_Customize_Manager{}

Хуков нет.

Возвращает

Строку/Разное. Sanitized value or the $default provided.

Использование

$WP_Customize_Manager = new WP_Customize_Manager();
$WP_Customize_Manager->post_value( $setting, $default );
$setting(WP_Customize_Setting) (обязательный)
A WP_Customize_Setting derived object.
$default(смешанный)
Value returned $setting has no post value (added in 4.2.0) or the post value is invalid (added in 4.6.0).
По умолчанию: null

Заметки

  • Смотрите: WP_REST_Server::dispatch()
  • Смотрите: WP_REST_Request::sanitize_params()
  • Смотрите: WP_REST_Request::has_valid_params()

Список изменений

С версии 3.4.0 Введена.
С версии 4.1.1 Introduced the $default parameter.
С версии 4.6.0 $default is now returned early when the setting post value is invalid.

Код WP_Customize_Manager::post_value() WP 5.5.3

<?php
public function post_value( $setting, $default = null ) {
	$post_values = $this->unsanitized_post_values();
	if ( ! array_key_exists( $setting->id, $post_values ) ) {
		return $default;
	}
	$value = $post_values[ $setting->id ];
	$valid = $setting->validate( $value );
	if ( is_wp_error( $valid ) ) {
		return $default;
	}
	$value = $setting->sanitize( $value );
	if ( is_null( $value ) || is_wp_error( $value ) ) {
		return $default;
	}
	return $value;
}