I'm trying to disable a few plugins when my mobile theme is loaded. I read somewhere about using this particular function in my mobile theme functions.php file to remove scripts and css.

//Disable plugins
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );

function my_deregister_javascript() {
    wp_deregister_script( 'smp_common','smp_cookie','smp_colorbox','smp_meerkat','jquery','query-ui-sortable' );
//Deregister styles
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );

Going by the above, i've been able to remove a few scripts, but unable to remove the 'share post' plugin as wp_enqueue is not mentioned in the script. Is there an alternative to disable this plugin?

2 Answers 2


No, you have to fix the plugin code. Also, send a bug report to the plugin author. I'm sure she wants to improve the plugin.

  • This is not correct. IF the plugin is setup with proper script / style enqueues, they can absolutely be removed. @Chris_O below is correct.
    – Pippin
    Commented May 3, 2012 at 15:55
  • 1
    @Pippin Re-read the question: as wp_enqueue is not mentioned in the script. The missing proper setup is the whole point of my answer …
    – fuxia
    Commented May 3, 2012 at 16:15
  • bah, my bad. I missed that.
    – Pippin
    Commented May 3, 2012 at 19:45

wp_deregister_script only takes a single script handle as the argument. Also it should be hooked into wp_enqueue_scripts not wp_print_scripts.

Also if the plugin is not using wp_enqueue it must be hooking into wp_head with add_action to print the inline script calls. You can remove the add_action function in the plugin with remove_action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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