Dequeue Simple Colorbox
Published March 16th, 2013 under Plugins
One of the recent updates to the Simple Colorbox plugin featured a subtle upgrade. This upgrade was on request of Asterbird on WordPress, who required the ability to unhook the built in CSS file in the Simple Colorbox plugin. To allow for this, I set the class to a variable, which you can access and unhook the CSS file.
The example code below shows how to do this.
<?php /* * Dequeue Simple Colorbox stylesheet * Uses the $simple_colorbox object to unhook the function * * @author Ryan Hellyer <ryanhellyer@gmail.com> * @since 1.0 * @global object $simple_colorbox */ function dequeue_simple_colorbox() { global $simple_colorbox; remove_action( 'wp_enqueue_scripts', array( $simple_colorbox, 'external_css' ) ); // Disable external CSS } add_action( 'init', 'dequeue_simple_colorbox' ); ?>
Here is a simple plugin which you can use to detach both scripts and styles. I suspect no one will ever have a use for this, but hopefully it will be helpful as a learning exercise.
Sarah says:
With version 1.6, replace external_css with css to make it work.
December 18, 2014 at 5:38 pm # //
Ryan says:
What do you mean?
December 18, 2014 at 7:27 pm # //