0

Im working on optimizing a child theme for a site and the parent "has more than we need"

Lots of requests being generated all adds up to performance hits. What I'm trying to accomplish is this effect :

wp_dequeue_script('handle')
wp_deregister_script('handle')

But the problem is that handle is a child of an array... meaning something like this is enqueuing the scripts initially :

wp_enqueue_script('handle', get_template_directory_uri().'/admin/js/dontwantit.js', array('handleContainer'));

There are any number of enqueued scripted being added to the handleContainer queue array.

is it possible to cherry pick out the ones I don't want? What would that look like? Thanks in advance

  • 2
    The third argument of wp_enqueue_script are dependencies, which just means the enqueued script must appear after the scripts it depends on. What action and priority are you trying to dequeue scripts on? Have you read the Codex page for wp_dequeue_script? – Milo Dec 6 '13 at 23:47
  • Hi Milo - yeah wow why i thought dependencies were a queue array is beyond me. Regarding your question of priority - the parent theme has priority omitted (so defaulted to 10) whereas my child theme's add_action hook call is set to 99 -- the idea being that its a lower priority and as such it should be able to find the scripts to remove – Brandt Solovij Dec 7 '13 at 0:07

Your Answer

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

Browse other questions tagged or ask your own question.