WP_Customize_Nav_Menus::export_preview_data()

In this article

Exports data from PHP to JS.

Source

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,
	);
	wp_print_inline_script_tag( sprintf( 'var _wpCustomizePreviewNavMenusExports = %s;', wp_json_encode( $exports ) ) );
}

Changelog

VersionDescription
4.3.0Introduced.

User Contributed Notes

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