WP_Customize_Setting::save() WordPress Method

The WP_Customize_Setting::save() method is used to save a Customizer setting. This method is called when the Customizer is saved. The Customizer setting is saved to the database as an option.

WP_Customize_Setting::save() #

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


Return

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


Top ↑

Source

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

	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 );
	}


Top ↑

Changelog

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