Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I an trying to enqueue four script files and keep getting this error: Fatal error: Allowed memory size of 103809024 bytes exhausted ... wp-includes/class.wp-dependencies.php on line 175.

I used wp_register_script like this:

        wp_register_script( 
        'sat-ba-cond', 
        $scriptsrc . 'jquery.ba-cond.min.js', 
        array('jquery'),
        '1.0', 
        true 
    );  

    wp_register_script( 
        'sat-slitsl', 
        $scriptsrc . 'jquery.slitslider.js', 
        array('jquery'),
        '1.0', 
        true 
    );  

    wp_register_script( 
        'sat-moderni', 
        $scriptsrc . 'modernizr.custom.79639.js', 
        array('jquery'),
        '1.0', 
        false 
    );  

    wp_register_script( 
        'sat-callslit', 
        $scriptsrc . 'call_slitslider.js', 
        array('jquery'),
        '1.0', 
        false 
    );

And wp_enqueue_script like this:

    wp_enqueue_script( 'sat-moderni' );
    wp_enqueue_script( 'sat-slitsl' );
    wp_enqueue_script( 'sat-ba-cond' );
    wp_enqueue_script( 'sat-callslit' );

What could be causing this problem? I have registered and enqueued other scripts as well, which I haven't included here because they have been working up until now. Only these four and wp_enqueue_script in particular is causing problems. What could be going on?

add_action( 'wp_enqueue_scripts', 'sat_load_javascript_files' );
function sat_load_javascript_files() {  

    $scriptsrc = get_template_directory_uri() . '/js/';

    wp_deregister_script('jquery');

    wp_register_script( 
        'jquery', 
        'http://code.jquery.com/jquery-1.7.2.min.js' 
    );

    wp_register_script( 
        'sat-bootstrap',
         $scriptsrc . 'bootstrap.min.js',
          array('jquery'), 
          '2.2.1', 
          true
    );

    wp_register_script( 
        'sat-masonry', 
        $scriptsrc . 'jquery.masonry.min.js', 
        array('jquery'),
        '1.0', 
        true 
    );  

    wp_register_script( 
        'sat-fitvid',
        $scriptsrc . 'jquery.fitvids.js',
        array('jquery'),
        '1.0',
        true
     ); 

    wp_register_script( 
        'sat-callfitvid',
        $scriptsrc . 'call_fitvid.js',
        array('jquery', 'sat-fitvid'),
        '1.0',
        true
     ); 

    wp_register_script(
        'sat-flexslider',
        $scriptsrc . 'jquery.flexslider-min.js',
        array('jquery'),
        '1.0',
        true
    );

    wp_register_script(
        'sat-callflexslider',
        $scriptsrc . 'call_flexslider.js',
        array('jquery', 'sat-flexslider'),
        '1.0',
        true
    );  

    wp_register_script( 
        'sat-mobcust', 
        $scriptsrc . 'jquery.mobile.customized.min.js', 
        array('jquery'),
        '1.0', 
        true 
    );  

    wp_register_script( 
        'sat-infinite', 
        $scriptsrc . 'jquery.infinitescroll.js', 
        array('jquery'),
        '1.0', 
        true 
    );  

    wp_register_script( 
        'sat-trigger', 
        $scriptsrc . 'manual-trigger.js', 
        array('jquery'),
        '1.0', 
        true 
    );  

    wp_register_script( 
        'sat-biggtoggle', 
        $scriptsrc . 'call_biotoggle.js', 
        array('jquery'),
        '1.0', 
        false 
    );

    wp_register_script( 
        'sat-mas-inf-blg', 
        $scriptsrc . 'masonry_isotope.js', 
        array('jquery', 'sat-masonry', 'sat-infinite'),
        '1.0', 
        true 
    );

    wp_register_script( 
        'sat-maslin-blg', 
        $scriptsrc . 'infinite_scroll_lin.js', 
        array('jquery', 'sat-infinite'),
        '1.0', 
        true 
    );

    wp_register_script( 
        'sat-mas_hyb', 
        $scriptsrc . 'masonry_hybrid.js', 
        array('jquery', 'sat-masonry', 'sat-infinite'),
        '1.0', 
        true 
    );

    wp_register_script( 
        'sat-ba-cond', 
        $scriptsrc . 'jquery.ba-cond.min.js', 
        array('jquery'),
        '1.0', 
        true 
    );  

    wp_register_script( 
        'sat-slitsl', 
        $scriptsrc . 'jquery.slitslider.js', 
        array('jquery'),
        '1.0', 
        true 
    );  

    wp_register_script( 
        'sat-moderni', 
        $scriptsrc . 'modernizr.custom.79639.js', 
        array('jquery'),
        '1.0', 
        false 
    );  

    wp_register_script( 
        'sat-callslit', 
        $scriptsrc . 'call_slitslider.js', 
        array('jquery'),
        '1.0', 
        false 
    );

    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'sat-fitvid' );
    wp_enqueue_script( 'sat-flexslider' );  
    wp_enqueue_script( 'sat-infinite' );
    wp_enqueue_script( 'sat-trigger' );
    wp_enqueue_script( 'sat-masonry' );
    wp_enqueue_script( 'sat-biggtoggle' );
    wp_enqueue_script( 'sat-callflexslider' );
    wp_enqueue_script( 'sat-callfitvid' );

    wp_enqueue_script( 'sat-moderni' );
    wp_enqueue_script( 'sat-slitsl' );
    wp_enqueue_script( 'sat-ba-cond' );
    wp_enqueue_script( 'sat-callslit' );

    if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); 

} 
share|improve this question
    
Can you post the entire callback and add_action() call? –  Chip Bennett Nov 30 '12 at 13:40
    
Ok, edited the post. –  charlenemasters Nov 30 '12 at 13:47
    
And just for debugging purposes: what happens if you get rid of your de-register/re-register of jQuery? –  Chip Bennett Nov 30 '12 at 13:52
    
the memory error is gone, and the local jquery script is being called, but all my other script are not working/reacting. is registering and de-registering prone to causing memory errors? –  charlenemasters Nov 30 '12 at 14:06
    
Unrelated to your question, but don't load jQuery like that (please). Use a plugin like Use Google Libraries or WP jQuery Plus that keep up with the core WP version as well instead of keeping tabs on this yourself. –  Zach Nov 30 '12 at 14:15
show 5 more comments

1 Answer 1

up vote 1 down vote accepted

The problem is the de-registering the core-bundled version of jQuery, and re-registering using your own, arbitrary version.

Do not de-register core-bundled versions of scripts (especially jQuery) in order to register arbitrary/custom versions of those scripts. Doing so can and will cause breakage and unintended consequences.

If you're doing so in order to cause your custom scripts to function properly, then the underlying problem lies with the way you call your scripts. Most likely, you are not accounting for jQuery no-conflict when you instantiate your scripts.

share|improve this answer
    
Ok, I'll look into the no-conflict issues right now. Thanks for the advice. I'll get back to this thread once I'm done. –  charlenemasters Nov 30 '12 at 14:29
    
Changing back into the core version of jquery and doing the no-conflict thing solved it. Everything's working. Thanks again –  charlenemasters Nov 30 '12 at 14:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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