diff --git a/src/wp-admin/theme-editor.php b/src/wp-admin/theme-editor.php index f82db5986dd8c..98de8cb6e2fd2 100644 --- a/src/wp-admin/theme-editor.php +++ b/src/wp-admin/theme-editor.php @@ -212,19 +212,45 @@ ); } -if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_theme() && current_user_can( 'customize' ) ) { - $message = '

' . __( 'Did you know?' ) . '

' . sprintf( - /* translators: %s: Link to Custom CSS section in the Customizer. */ - __( 'There is no need to change your CSS here — you can edit and live preview CSS changes in the built-in CSS editor.' ), - esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) ) - ) . '

'; - wp_admin_notice( - $message, - array( - 'type' => 'info', - 'id' => 'message', - ) - ); +if ( preg_match( '/\.css$/', $file ) ) { + if ( ! wp_is_block_theme() && current_user_can( 'customize' ) ) { + $message = '

' . __( 'Did you know?' ) . '

' . sprintf( + /* translators: %s: Link to add custom CSS section in either the Customizer (classic themes) or Site Editor (block themes). */ + __( 'There is no need to change your CSS here — you can edit and live preview CSS changes in the built-in CSS editor.' ), + esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) ) + ) . '

'; + wp_admin_notice( + $message, + array( + 'type' => 'info', + 'id' => 'message', + ) + ); + } elseif ( wp_is_block_theme() && current_user_can( 'edit_theme_options' ) ) { + $message = '

' . __( 'Did you know?' ) . '

' . sprintf( + /* translators: %s: Link to add custom CSS section in either the Customizer (classic themes) or Site Editor (block themes). */ + __( 'There is no need to change your CSS here — you can edit and live preview CSS changes in the built-in CSS editor.' ), + esc_url( admin_url( 'site-editor.php?p=%2Fstyles§ion=%2Fcss' ) ) + ) . '

'; + wp_admin_notice( + $message, + array( + 'type' => 'info', + 'id' => 'message', + ) + ); + } + if ( file_exists( preg_replace( '/\.css$/', '.min.css', $file ) ) ) { + $message = '

' . __( 'There is a minified version of this stylesheet.' ) . '

' . + __( 'It is likely that this unminified stylesheet will not be served to visitors.' ) . '

'; + wp_admin_notice( + $message, + array( + 'type' => 'warning', + 'id' => 'wp-css-min-warning', + ) + ); + } } ?>