Question

Wordpress has wp_enqueue_script() but not a wp_dequeue_script() function, so what would be the best way to dequeue a script? I'm using LAB.js to load all of my scripts rather than enqueueing them server side, so I don't want plugins running around adding jQuery 10 times when I'm already loading it.

Would using wp_deregister_script( 'jquery' ) accomplish the same purpose?

Was it helpful?

Solution

There is a dequeue method available ... I'm just not sure why it isn't wrapped in a wp_dequeue_script() method. (I might create a ticket for this issue, actually)

But yes, using wp_deregister_script will accomplish what you're trying to do. Just remember, if you ever do want to use WP's built-in jQuery later you'll need to re-queue it first.

OTHER TIPS

Since WordPress 3.1 there is actually a wp_dequeue_script() function available.

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top