Skip to content
Closed
Changes from all commits
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
17 changes: 17 additions & 0 deletions src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -3640,3 +3640,20 @@ function _wp_theme_json_webfonts_handler() {
add_action( 'wp_enqueue_scripts', $fn_generate_and_enqueue_styles );
add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles );
}

/**
* Loads classic theme styles on classic themes.
*
* This is needed for backwards compatibility for button blocks specifically.
*/
function wp_enqueue_classic_theme_styles() {
if ( ! wp_is_block_theme() ) {
$suffix = wp_scripts_get_suffix();
wp_register_style( 'classic-theme-styles', "/wp-includes/css/dist/block-library/classic$suffix.css", array(), true );
wp_enqueue_style( 'classic-theme-styles' );
}
}
// To load classic theme styles on the frontend.
add_action( 'wp_enqueue_scripts', 'wp_enqueue_classic_theme_styles' );
// To load classic theme styles in the the editor.
add_action( 'admin_enqueue_scripts', 'wp_enqueue_classic_theme_styles' );
Comment on lines +3656 to +3659
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should probably be moved to wp-includes/default-filters.php where all other core hooks live. Probably around https://github.com/WordPress/wordpress-develop/blob/trunk/src/wp-includes/default-filters.php#L558

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll handle this in the merge though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @dream-encode!