WP_Customize_Setting::save()publicWP 3.4.0

Checks user capabilities and theme supports, and then saves the value of the setting.

Метод класса: WP_Customize_Setting{}

Хуки из метода

Возвращает

null|false. Void on success, false if cap check fails or value isn't set or is invalid.

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

$WP_Customize_Setting = new WP_Customize_Setting();
$WP_Customize_Setting->save();

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

С версии 3.4.0 Введена.

Код WP_Customize_Setting::save() WP 6.4.3

final public function save() {
	$value = $this->post_value();

	if ( ! $this->check_capabilities() || ! isset( $value ) ) {
		return false;
	}

	$id_base = $this->id_data['base'];

	/**
	 * Fires when the WP_Customize_Setting::save() method is called.
	 *
	 * The dynamic portion of the hook name, `$id_base` refers to
	 * the base slug of the setting name.
	 *
	 * @since 3.4.0
	 *
	 * @param WP_Customize_Setting $setting WP_Customize_Setting instance.
	 */
	do_action( "customize_save_{$id_base}", $this );

	$this->update( $value );
}