WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.

share|improve this answer
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 May 3 '12 at 15:55
@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 … – toscho May 3 '12 at 16:15
bah, my bad. I missed that. – Pippin May 3 '12 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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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