1

I'm having this really weird, never seen before, issue ... whenever I visit the Dashboard, after about 3-5 seconds, my theme loads into the Dashboard layout. It's like the theme's stylesheet is being enqueued somehow ...

enter image description here

Here is my enqueue hook within functions.php:

function myyogawebsite_scripts() {

    wp_enqueue_style( 'foundation-normalize', get_template_directory_uri() . '/css/normalize.css' );
    wp_enqueue_style( 'foundation-min-css', get_template_directory_uri() . '/css/foundation.min.css' );

    // WordPress Core
    wp_enqueue_style( 'wordpress-core-css', get_template_directory_uri() . '/css/wp-core.css' );

    // Load our main stylesheet.
    wp_enqueue_style( 'myyogawebsite-style', get_template_directory_uri() . '/style.css' );

    wp_enqueue_script( 'foundation-jquery', get_template_directory_uri() . '/js/jquery.js', null, null, false);

    wp_enqueue_script( 'foundation-modernizr', get_template_directory_uri() . '/js/modernizr.js', null, null, true);
    wp_enqueue_script( 'foundation-min-js', get_template_directory_uri() . '/js/foundation.min.js', array('foundation-jquery'), null, true);

}
add_action( 'wp_enqueue_scripts', 'myyogawebsite_scripts' );
6
  • Well, is it being enqueued? :) Do you see it in page source or in browser's dev tools log of resources being loaded? – Rarst Apr 28 '14 at 20:47
  • Well, I see it being loaded, but I have no idea why it is ... my functions.php file is pretty simple. I'll post it above. – dcolumbus Apr 28 '14 at 21:16
  • Have you found a solution to this problem? I am having the same issue. It occurs whether or not I have my theme or 2014 loaded - with plugins turned off, etc. I deleted Wordpress folders wp-admin and wp-includes, and all files except .htaccess and wp-config.php. Still loads all css into dashboard with the site appearing under wordpress news. – user52628 Jun 3 '14 at 20:05
  • See here – eyoung100 Jun 3 '14 at 20:52
  • @ECarterYoung -- the OP appears to be using the correct hook (wp_enqueue_scripts vs. init in the link you posted). – Pat J Jun 3 '14 at 23:22
1

I'm experiencing the exact same problem, and it makes using the editor very difficult. I can only assume that it is a bug with one of the newer versions of WordPress in certain scenarios / configurations.

Until it gets fixed properly my workaround is to wrap my enqueue statements in an if statement for !is_admin().

For example, in your case:

function myyogawebsite_scripts() {
    if(!is_admin()) {
        wp_enqueue_style( 'foundation-normalize', get_template_directory_uri() . '/css/normalize.css' );
        wp_enqueue_style( 'foundation-min-css', get_template_directory_uri() . '/css/foundation.min.css' );

        // WordPress Core
        wp_enqueue_style( 'wordpress-core-css', get_template_directory_uri() . '/css/wp-core.css' );

        // Load our main stylesheet.
        wp_enqueue_style( 'myyogawebsite-style', get_template_directory_uri() . '/style.css' );

        wp_enqueue_script( 'foundation-jquery', get_template_directory_uri() . '/js/jquery.js', null, null, false);

        wp_enqueue_script( 'foundation-modernizr', get_template_directory_uri() . '/js/modernizr.js', null, null, true);
        wp_enqueue_script( 'foundation-min-js', get_template_directory_uri() . '/js/foundation.min.js', array('foundation-jquery'), null, true);
    }
}
add_action( 'wp_enqueue_scripts', 'myyogawebsite_scripts' );

See how that works for you. What version of WordPress are you using, and what platform is your website hosted on (eg. Linux, Windows). I'm on WP4.0 on Windows.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.