Remove the classic theme style after upgrading WordPress 6.1

WordPress one three hundred and fifty-nine Reading mode

After upgrading to WordPress 6.1, check the source code and find a style code in the header:

 <style id='classic-theme-styles-inline-css' type='text/css'> /*!  This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} </style>

It is probably prepared for WordPress default theme that does not have site editing function, but the default theme that is not used also has this, which is inexplicable, and should be automatically added by the system.

Removal method, Add the following code to the current theme function template functions.php:

 add_action( 'wp_enqueue_scripts', 'zm_remove_classic_heme_styles', 20 ); function zm_remove_classic_theme_styles() { wp_dequeue_style( 'classic-theme-styles' ); }

Or simplified code:

 add_action( 'wp_enqueue_scripts', function() { wp_dequeue_style( 'classic-theme-styles' ); }, 20 );

feel WordPress Developers are making mistakes again.

 Remove the classic theme style after upgrading WordPress 6.1

Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!

 weinxin
My Wechat
Copyright Notice
Please indicate the source and link of the original article reprinted on this site. Thank you for your cooperation!
five hundred and ninety-eight million eight hundred and forty-five thousand and six
 
 Robin
five hundred and ninety-eight million eight hundred and forty-five thousand and six
    •  Love Resources
      Love Resources one

      Come in and learn

     anonymous

    Comment

    Anonymous netizens
     :?:  :razz:  :sad:  :evil:  :!:  :smile:  :oops:  :grin:  :eek:  :shock:  :???:  :cool:  :lol:  :mad:  :twisted:  :roll:  :wink:  :idea:  :arrow:  :neutral:  :cry:  :mrgreen:

    Drag the slider to complete validation