Created
November 8, 2013 22:33
-
-
Save pdewouters/7378767 to your computer and use it in GitHub Desktop.
change plugin active order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Push Gravity Forms to the top of the list of plugins to make sure it's loaded before any add-ons | |
| add_action("activated_plugin", array("GFForms", "load_first")); | |
| } | |
| public static function load_first() { | |
| $plugin_path = basename(dirname(__FILE__)) . "/gravityforms.php"; | |
| $active_plugins = get_option('active_plugins'); | |
| $key = array_search($plugin_path, $active_plugins); | |
| if ($key > 0) { | |
| array_splice($active_plugins, $key, 1); | |
| array_unshift($active_plugins, $plugin_path); | |
| update_option('active_plugins', $active_plugins); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment