Replace @import in WordPress Child Themes

Stop using @import in child themes. Use the following code in your functions.php file to enqueue the parent theme style.css file, and avoid using @import.


add_action( 'wp_enqueue_scripts', 'my_child_theme_scripts' );
function my_child_theme_scripts() {
    wp_enqueue_style( 'parent-theme-css', get_template_directory_uri() . '/style.css' );
}

reference: https://konstantin.blog/2014/child-themes-import/

Scroll to Top