WP_Customize_Nav_Menus::export_preview_data()
Exports data from PHP to JS.
Method of the class: WP_Customize_Nav_Menus{}
No Hooks.
Return
null
. Nothing (null).
Usage
$WP_Customize_Nav_Menus = new WP_Customize_Nav_Menus(); $WP_Customize_Nav_Menus->export_preview_data();
Changelog
Since 4.3.0 | Introduced. |
WP_Customize_Nav_Menus::export_preview_data() WP Customize Nav Menus::export preview data code WP 6.6.2
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 ) ) ); }