wp_block_theme_activate_nonce

The timeline below displays how wordpress function wp_block_theme_activate_nonce has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * 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.
 *
 * @see https://github.com/WordPress/gutenberg/pull/41836
 *
 * @since 6.3.0
 * @access private
 */
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 
}

WordPress Version: 6.3

/**
 * 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.
 *
 * @see https://github.com/WordPress/gutenberg/pull/41836.
 *
 * @since 6.3.0
 * @private
 */
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 
}