ThemeShaper Forums » Thematic

[closed]

WP 3.3.1 WSOD on wp-login.php

(10 posts)
  • Started 2 years ago by ryanbakernz
  • Latest reply from helgatheviking
  • This topic is not resolved
  1. Hi there, I upgraded to WP 3.3.1 and started getting a blank screen / white screen of death (WSOD) on the wp-login.php. I isolated this down to Thematic and this line in functions.php:

    // Load jQuery
    wp_enqueue_script('jquery');

    If I take this out, all is fine, but now I am wondering what won't function on the site without this line present.

    I suspect I am not the only one who has faced this problem and I apologise if it is ground you have already covered on these support forums.

    Any advice or guidance would be greatly appreciated.

    Posted 2 years ago #
  2. you disable all plugins? b/c i haven't seen this problem and have 3.3.1 on my local install.

    Posted 2 years ago #
  3. middlesister
    Member

    Hm. I wonder if this is because it is not recommended today that you enqueue scripts directly in functions.php, which that version of thematic is doing. This function call should be attached to a hook. WP 3.3 is generating an error notice about incorrect use, but it should not kill your site.

    Anyway, this is fixed in the latest version of thematic. I recommend updating to the latest SVN version.

    If you find the svn process a bit daunting, you can make a temporary fix with replacing that line with

    function my_enqueue_scripts() {
        wp_enqueue_script('jquery');
    }
    add_action('wp_enqueue_scripts', 'my_enqueue_scripts');

    Gene is working on submitting the latest thematic version to the wordpress repository as soon as possible but we don't have a fixed timeline.

    Posted 2 years ago #
  4. still can't reproduce this. can you add

    define('WP_DEBUG', true);

    to your wp-config.php file so you can get useful error messages?

    middlesister, question - the beta is enqueing scripts on the get_header() hook. isn't it advised to use the wp_enqueue_scripts() hook? also, is it necessary to register and then enqueue? can't you just enqueue like so:

    wp_enqueue_script('supersubs', $scriptdir . 'supersubs.js');
    Posted 2 years ago #
  5. middlesister
    Member

    I can't reproduce it either. I have the plugin Log Deprecated Notices and the error is shown there (not in my debug.log funnily enough), but the site doesn't break in any way.

    I think you should use a hook, period. Don't think the header or wp_enqueue_scripts really matter (though I would enqueue scripts on the hook created for it), as long as it is after init. Putting the call straight into the functions.php file like thematic used to do (or straight into a plugin file) will cause the function to execute when functions.php gets included, which is before the init action. This is apparently a Bad Thing and has caused some plugins to fail. Even though it says in the codex that wp_enqueue_script() always should be called from within an action, not everyone has apparently been following that so they decided to put in an error notice for a heads up.

    If I understand right, I think everything i supposed to be attached to some hook or another. Like thematic_theme_setup() is attached to after_theme_setup in the latest svn. This let you have control over exactly when each function is executed and makes sure the variables you need have been initialized (like the conditionals).

    Posted 2 years ago #
  6. colfelt
    Member

    Hi there, I'm having this issue too. I'm running the latest version of Thematic (0.9.7.7) and am building a child theme. The issue occurs at various times when I submit various things like posts or changes to plugin settings in the admin interface. I get the white-screen-o'death arrgh...

    I am working on a local server. I turned on debugging, and this is the error message I get.

    Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or init hooks. Please see Debugging in WordPress for more information. (This message was added in version 3.3.) in /Applications/MAMP/htdocs/dev.different.com.au/wp-includes/functions.php on line 3587
    
    Warning: Cannot modify header information - headers already sent by (output started at /Applications/MAMP/htdocs/dev.different.com.au/wp-includes/functions.php:3587) in /Applications/MAMP/htdocs/dev.different.com.au/wp-includes/pluggable.php on line 866

    So I get the big picture behind using a hook... and making sure things don't get registered/enqueued before wp_enqueue_script()... but I'm a bit of a newbie and don't understand the detail of where I need to make the required changes... and exactly what those changes should be. Can someone break it down for me as if I've got special needs?

    Thanks.

    [EDIT] - I just realised I'm posting this to the wrong thread... it probably needs to go somewhere else. Perhaps a moderator can advise. Cheers.

    Posted 2 years ago #
  7. colfelt
    Member

    OK, answering my own question somewhat, but raising another... in thematic's functions.php file, on line 80 there is this piece of code:

    wp_enqueue_script('jquery');

    Commenting this out fixes the problem. Obviously, jquery now won't work unless I get it put back in somewhere else. I was thinking about adding it to the header.php... but thought someone here would probably have a smarter idea.

    Any thoughts?

    Posted 2 years ago #
  8. 0.9.7.7 is not the best version to be using. at least use

    http://developing.thematic4you.com/thematic-development-release/

    but the SVN version at code.google.com/thematic is pretty stable, it is the one we're trying to get submitted to the WP theme repo.

    also, this was working fine for ever (and middlesister and myself could not reproduce it) which tells me the problem doesn't originate w/ thematic, but perhaps w/ a plugin or in your child's functions.php. it definitely isn't the way to properly enqueue scripts and that is one of the things being fixed in the new version, but a "warning" doesn't cause a WSOD.

    Posted 2 years ago #
  9. colfelt
    Member

    OK, thanks for that! By the way, I found removing wp_enqueue_script('jquery'); and putting it back in the head worked fine to resolve the issue. But would be better to do it *properly* so I may go download the newest version.

    Posted 2 years ago #
  10. there has to be some other issue b/c if improper enqueing was responsible for the WSOD nobody'd be able to use thematic. the problem feels too isolated. the enqueing still isn't fixed in that dev version, it has finally been fixed in the SVN trunk. we're waiting on gene to submit it to WP.

    i just re-read your error message. the enqueue scripts is a notice. that means it isn't causing the WSOD. the WSOD is caused by the headers already sent error. it just isn't that useful, b/c the problem isn't in pluggable.php.

    headers already sent errors mean you have white space before the opening <?php or after the closing ?> somewhere.... usually in your functions.php b/c that is the one you are working in.

    <?php
    //this is ok
    ?>

    versus

    //this will cause WSOD
    <?php
    //ok
    ?>
    //so will this
    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.