diff --git a/wp-admin/includes/admin-filters.php b/wp-admin/includes/admin-filters.php index 8f364360fd..33354cb073 100644 --- a/wp-admin/includes/admin-filters.php +++ b/wp-admin/includes/admin-filters.php @@ -168,10 +168,3 @@ add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_up // Append '(Draft)' to draft page titles in the privacy page dropdown. add_filter( 'list_pages', '_wp_privacy_settings_filter_draft_page_titles', 10, 2 ); - -// Attaches filters to enable theme previews in the Site Editor. -if ( ! empty( $_GET['wp_theme_preview'] ) ) { - add_filter( 'stylesheet', 'wp_get_theme_preview_path' ); - add_filter( 'template', 'wp_get_theme_preview_path' ); - add_action( 'init', 'wp_attach_theme_preview_middleware' ); -} diff --git a/wp-admin/includes/admin.php b/wp-admin/includes/admin.php index 4930e92b71..ce2ec0c68b 100644 --- a/wp-admin/includes/admin.php +++ b/wp-admin/includes/admin.php @@ -71,7 +71,6 @@ require_once ABSPATH . 'wp-admin/includes/list-table.php'; /** WordPress Theme Administration API */ require_once ABSPATH . 'wp-admin/includes/theme.php'; -require_once ABSPATH . 'wp-admin/includes/theme-previews.php'; /** WordPress Privacy Functions */ require_once ABSPATH . 'wp-admin/includes/privacy-tools.php'; diff --git a/wp-admin/includes/theme-previews.php b/wp-admin/includes/theme-previews.php index 55a3679096..d9325ddbf3 100644 --- a/wp-admin/includes/theme-previews.php +++ b/wp-admin/includes/theme-previews.php @@ -54,3 +54,31 @@ function wp_attach_theme_preview_middleware() { 'after' ); } + +/** + * 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(); + ?> + +