Uses
Uses | Description |
---|---|
wp-includes/functions.php: wp_json_encode() | Encode a variable into JSON, with some sanity checks. |
Exports data from PHP to JS.
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 ) ); }
Version | Description |
---|---|
4.3.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_nav_menus/export_preview_data