Skip to content

Commit

Permalink
Allow global-styles to be loaded on classic themes
Browse files Browse the repository at this point in the history
Our properties won't be overwritten now, and this prevents future conflicts where necessary styles are added via `global-styles`.
  • Loading branch information
ryelle committed Aug 1, 2022
1 parent 7c3e0bf commit cf6af76
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions mu-plugins/blocks/global-header-footer/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
add_action( 'rest_api_init', __NAMESPACE__ . '\register_routes' );
add_filter( 'wp_enqueue_scripts', __NAMESPACE__ . '\register_block_assets', 200 ); // Always last.
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_compat_wp4_styles', 5 ); // Before any theme CSS.
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\unregister_classic_global_styles', 20 );
add_action( 'wp_head', __NAMESPACE__ . '\preload_google_fonts' );
add_filter( 'style_loader_src', __NAMESPACE__ . '\update_google_fonts_url', 10, 2 );
add_filter( 'render_block_core/navigation-link', __NAMESPACE__ . '\swap_submenu_arrow_svg' );
Expand Down Expand Up @@ -196,18 +195,6 @@ function enqueue_compat_wp4_styles() {
}
}

/**
* Unregister the `global-styles` from classic themes, to avoid overwriting our custom properties.
*/
function unregister_classic_global_styles() {
if ( wp_is_block_theme() ) {
return;
}

wp_dequeue_style( 'global-styles' );
wp_deregister_style( 'global-styles' );
}

/**
* Remove the wrapping element to preserve markup.
*
Expand Down

0 comments on commit cf6af76

Please sign in to comment.