Removing an action in one network-enabled plugin from another
-
Hi all,
I have a network activated plugin that detects mobile devices and displays the site in a mobile-friendly way. What I want to accomplish is a way to disable this plugin from initializing for any given site that chooses to do so. I have made a settings screen and am using the options table to store whether or not the site wants to use the mobile plugin. The problem is getting the remove_action() function to work. I know it’s probably an order of execution problem or I’m using the wrong hook, but I found that it does work from a non-network activated plugin.So here’s the code from the mobile plugin for the action I want to remove:
add_action('setup_theme','mobile_init');
function mobile_init() {...
And here is the code I am trying to use in another network-activated plugin that runs when the value in the options table is set to not use the mobile plugin:
remove_action('setup_theme','et_mobile_init');
Again, this works great when I put it inside a non-network-activated plugin. Maybe there’s a better way to do this other than calling the remove_action() function. I have spent some time now looking for a solution and haven’t come up with one yet. (And no, making the mobile plugin non-network-activated is not an option.)
Thanks in advanced to anyone who can help!
-Patrick
- The topic ‘Removing an action in one network-enabled plugin from another’ is closed to new replies.