Disable WordPress plugin for specific theme

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Wordpress Plugin Tutorial  //  No Comments

I have a regular theme and a mobile theme, and I would like to disable a plugin when using the mobile theme because it is causing problems (but I need to keep the plugin enabled for the regular theme). Is there any way to disable a specific plugin for a specific theme in WordPress?

you could use the is_phone call to remove an specific function in the plugin that is screwing things up. Not sure on disabling a plugin entirely.

<?php if ( $is_iphone ) {
          remove_action( $tag, $function_to_remove, $priority, $accepted_args );
     } 
?>

remove_action function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific action hook and possibly replace them with a substitute.

Parameters:

$tag(string) (required) – The action hook to which the function to be removed is hooked.Default: None

$function_to_remove(string) (required) – The name of the function which should be removed.Default: None

$priority(int) (optional) – The priority of the function (as defined when the function was originally hooked).Default: 10

$accepted_args(int) (optional) – The number of arguments the function accepts.Default: 1

Leave a comment

Share This Post

RSS Wordpress News