Closed QWp6t closed 10 years ago
This makes no sense you can dequeue scripts with WP in native way without any special things added to plugins or themes.
I agree, if the user needs to dequeue scripts he/she should do so in their theme or in another plugin.
@QWp6t its as easy as this btw (untested but should work)
add_action( 'wp_print_scripts', 'de_script' );
function de_script() {
wp_dequeue_script( 'bootstrap-shortcodes-tooltip' );
wp_dequeue_script( 'bootstrap-shortcodes-popover' );
}
I use this for my plugins so that developers don't have to unnecessarily fire the enqueue and then dequeue actions. It's more optimal to use a constant and it's not like it disrupts the functionality of the plugin.
I initially got the idea from this plugin: http://wordpress.org/plugins/wpsocialite/
Anyway, it's just my preference.
Setting
LOAD_BS_SHORTCODES_SCRIPTS
tofalse
(or anything other thantrue
) will cause the function that loads the scripts to exit without enqueuing the scripts.This is useful when users concatenate and uglify their JS.
NOTE: scripts load fine when constant is not defined.
This PR is one of many ways this could be accomplished. It was just the fastest way I could think of that will have a very minimal impact on your plugin.