• I’ve created a child theme, and in it’s functions.php I have the following line which loads “style.css” in the child folder:

    wp_enqueue_style( ‘main_css’, get_stylesheet_uri() );

    This works fine on the site, however the same stylesheet is also being loaded whilst in the WordPress admin pages. Why? It’s causing some of the sections to look add, and I was tearing my hair out wondering if a plugin was causing this at first.

    Simple fix?

Viewing 1 replies (of 1 total)
  • Thread Starter pixelkicks

    (@pixelkicks)

    Found the solution.

    Instead of the code I showed above, I used this instead:

    add_action( ‘wp_enqueue_scripts’, ‘load_child_stylesheet’ );
    function load_child_stylesheet() {
    wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, false, ‘1.0’, ‘all’ );
    }

    Works perfect now, and the stylesheet only gets loaded on the front-end, and not in the admin.

Viewing 1 replies (of 1 total)
  • The topic ‘Child theme CSS being loaded in admin pages’ is closed to new replies.