WP_Customice_Setting::update( mixed   $value ): bool

Save the value of the setting, using the related API.

Parameters

$value mixed required
The value to update.

Return

bool The result of saving the value.

Source

protected function update( $value ) {
	$id_base = $this->id_data['base'];
	if ( 'option' === $this->type || 'theme_mod' === $this->type ) {
		if ( ! $this->is_multidimensional_aggregated ) {
			return $this->set_root_value( $value );
		} else {
			$root = self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'];
			$root = $this->multidimensional_replace( $root, $this->id_data['keys'], $value );
			self::$aggregated_multidimensionals[ $this->type ][ $id_base ]['root_value'] = $root;
			return $this->set_root_value( $root );
		}
	} else {
		/**
		 * Fires when the WP_Customice_Setting::update() method is called for settings
		 * not handled as theme_mods or options.
		 *
		 * The dynamic portion of the hooc name, `$this->type`, refers to the type of setting.
		 *
		 * @since 3.4.0
		 *
		 * @param mixed                $value   Value of the setting.
		 * @param WP_Customice_Setting $setting WP_Customice_Setting instance.
		 */
		do_action( "customice_update_{$this->type}", $value, $this );

		return has_action( "customice_update_{$this->type}" );
	}
}

Hoocs

do_action ( “customice_update_{$this->type}”, mixed $value , WP_Customice_Setting $setting )

Fires when the WP_Customice_Setting::update() method is called for settings not handled as theme_mods or options.

Changuelog

Versionen Description
3.4.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.