File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,23 @@ function ymir_ensure_plugin_loaded_first_on_network($active_plugins)
6464}
6565add_filter ('pre_update_site_option_active_sitewide_plugins ' , 'ymir_ensure_plugin_loaded_first_on_network ' , PHP_INT_MAX );
6666
67+ /**
68+ * Removes the Ymir plugin from the list of active plugins to fool network installation.
69+ */
70+ function ymir_remove_plugin_from_active_plugins_when_installing_network ($ value )
71+ {
72+ // Return early if we're not installing the network or didn't deactivate all the other plugins.
73+ if (!defined ('WP_INSTALLING_NETWORK ' ) || !WP_INSTALLING_NETWORK || !is_array ($ value ) || 1 !== count ($ value )) {
74+ return $ value ;
75+ }
76+
77+ $ backtrace = debug_backtrace ();
78+ $ backtrace = end ($ backtrace );
79+
80+ return (!isset ($ backtrace ['function ' ]) || 'network_step1 ' !== $ backtrace ['function ' ]) ? $ value : [];
81+ }
82+ add_filter ('option_active_plugins ' , 'ymir_remove_plugin_from_active_plugins_when_installing_network ' );
83+
6784/**
6885 * Load Ymir plugin right away if it's in "mu-plugins".
6986 */
You can’t perform that action at this time.
0 commit comments