Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix the other request too
  • Loading branch information
ellatrix committed Oct 25, 2024
commit 167c59645d29395d09110e7a0321f847c5e9b728
18 changes: 11 additions & 7 deletions lib/compat/wordpress-6.8/preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@
* @return array Filtered preload paths.
*/
function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
$excluded_paths = array();
if ( 'core/edit-site' === $context->name || 'core/edit-post' === $context->name ) {
$stylesheet = get_stylesheet();
$global_styles_path = '/wp/v2/global-styles/themes/' . $stylesheet;
$paths[] = $global_styles_path . '?context=view';
foreach ( $paths as $key => $path ) {
if ( $path === $global_styles_path ) {
unset( $paths[ $key ] );
}
$stylesheet = get_stylesheet();
$global_styles_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_global_styles_post_id();
$paths[] = '/wp/v2/global-styles/themes/' . $stylesheet . '?context=view';
$paths[] = '/wp/v2/global-styles/' . $global_styles_id . '?context=view';
$excluded_paths[] = '/wp/v2/global-styles/themes/' . $stylesheet;
$excluded_paths[] = '/wp/v2/global-styles/' . $global_styles_id;
}
foreach ( $paths as $key => $path ) {
if ( in_array( $path, $excluded_paths, true ) ) {
unset( $paths[ $key ] );
}
}
return $paths;
Expand Down