Changeset 56758
- Timestamp:
- 10/02/2023 10:54:29 PM (12 months ago)
- Location:
- branches/6.3
- Files:
-
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/6.3
- Property svn:mergeinfo changed
/trunk merged: 56529,56757
- Property svn:mergeinfo changed
-
branches/6.3/src/wp-includes/default-filters.php
r56140 r56758 534 534 add_action( 'transition_post_status', '_wp_keep_alive_customize_changeset_dependent_auto_drafts', 20, 3 ); 535 535 536 // Block Theme Previews. 537 add_action( 'plugins_loaded', 'wp_initialize_theme_preview_hooks', 1 ); 538 536 539 // Calendar widget cache. 537 540 add_action( 'save_post', 'delete_get_calendar_cache' ); -
branches/6.3/src/wp-includes/theme-previews.php
r56218 r56758 76 76 } 77 77 78 // Attaches filters to enable theme previews in the Site Editor. 79 if ( ! empty( $_GET['wp_theme_preview'] ) ) { 80 add_filter( 'stylesheet', 'wp_get_theme_preview_path' ); 81 add_filter( 'template', 'wp_get_theme_preview_path' ); 82 add_action( 'init', 'wp_attach_theme_preview_middleware' ); 83 add_action( 'admin_head', 'wp_block_theme_activate_nonce' ); 78 /** 79 * Add filters and actions to enable Block Theme Previews in the Site Editor. 80 * 81 * The filters and actions should be added after `pluggable.php` is included as they may 82 * trigger code that uses `current_user_can()` which requires functionality from `pluggable.php`. 83 * 84 * @since 6.3.2 85 */ 86 function wp_initialize_theme_preview_hooks() { 87 if ( ! empty( $_GET['wp_theme_preview'] ) ) { 88 add_filter( 'stylesheet', 'wp_get_theme_preview_path' ); 89 add_filter( 'template', 'wp_get_theme_preview_path' ); 90 add_action( 'init', 'wp_attach_theme_preview_middleware' ); 91 add_action( 'admin_head', 'wp_block_theme_activate_nonce' ); 92 } 84 93 } -
branches/6.3/tests/phpunit/tests/theme-previews.php
r56529 r56758 18 18 public function test_initialize_theme_preview_hooks() { 19 19 $_GET['wp_theme_preview'] = 'twentytwentythree'; 20 do_action( 'plugins_loaded' ); // Ensure `plugins_loaded` triggers ` initialize_theme_preview_hooks`.20 do_action( 'plugins_loaded' ); // Ensure `plugins_loaded` triggers `wp_initialize_theme_preview_hooks`. 21 21 22 22 $this->assertEquals( has_filter( 'stylesheet', 'wp_get_theme_preview_path' ), 10 );
Note: See TracChangeset
for help on using the changeset viewer.