WP_Customize_Nav_Menus::export_preview_data() WordPress Method

The WP_Customize_Nav_Menus::export_preview_data() method is used to export the data for a menu in the Customizer preview.

WP_Customize_Nav_Menus::export_preview_data() #

Exports data from PHP to JS.


Source

File: wp-includes/class-wp-customize-nav-menus.php

	public function export_preview_data() {

		// Why not wp_localize_script? Because we're not localizing, and it forces values into strings.
		$exports = array(
			'navMenuInstanceArgs' => $this->preview_nav_menu_instance_args,
		);
		printf( '<script>var _wpCustomizePreviewNavMenusExports = %s;</script>', wp_json_encode( $exports ) );
	}


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.