WP_Customize_Nav_Menu_Setting::amend_customize_save_response() WordPress Method

The WP_Customize_Nav_Menu_Setting::amend_customize_save_response() method is used to amend the customizer save response for nav menu settings. This is useful for setting the updated_timestamp for a nav_menu.

WP_Customize_Nav_Menu_Setting::amend_customize_save_response( array $data ) #

Export data for the JS client.


Description

Top ↑

See also


Top ↑

Parameters

$data

(array)(Required)Additional information passed back to the 'saved' event on wp.customize.


Top ↑

Return

(array) Export data.


Top ↑

Source

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

	public function amend_customize_save_response( $data ) {
		if ( ! isset( $data['nav_menu_updates'] ) ) {
			$data['nav_menu_updates'] = array();
		}
		if ( ! isset( $data['widget_nav_menu_updates'] ) ) {
			$data['widget_nav_menu_updates'] = array();
		}

		$data['nav_menu_updates'][] = array(
			'term_id'          => $this->term_id,
			'previous_term_id' => $this->previous_term_id,
			'error'            => $this->update_error ? $this->update_error->get_error_code() : null,
			'status'           => $this->update_status,
			'saved_value'      => 'deleted' === $this->update_status ? null : $this->value(),
		);

		$data['widget_nav_menu_updates'] = array_merge(
			$data['widget_nav_menu_updates'],
			$this->_widget_nav_menu_updates
		);
		$this->_widget_nav_menu_updates  = array();

		return $data;
	}


Top ↑

Changelog

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