wp_block_theme_activate_nonce() – Set a JavaScript constant for theme activation.
You appear to be a bot. Output may be restricted
Description
Set a JavaScript constant for theme activation.
Sets the JavaScript global WP_BLOCK_THEME_ACTIVATE_NONCE containing the nonce required to activate a theme. For use within the site editor.
Usage
wp_block_theme_activate_nonce();
Parameters
Returns
void
Source
File name: wordpress/wp-includes/theme-previews.php
Lines:
1 to 10 of 10
function wp_block_theme_activate_nonce() { $nonce_handle = 'switch-theme_' . wp_get_theme_preview_path(); ?> <script type="text/javascript"> window.WP_BLOCK_THEME_ACTIVATE_NONCE = <?php echo wp_json_encode( wp_create_nonce( $nonce_handle ) ); ?>; </script> <?php }