I am running a WP Multisite Network.
I am curious to know how WordPress knows that a plugin is installed on a network site:
- how does WP know that a plugin is Network Activated?
- how does WP know that a plugin is activated at the site level?
Does it record this instance in a DB Table somewhere? If so, which table and how is it tagged?
Thanks for helping.
1 Answer
You can clearly see the way WordPress loads plugins if you inspect the source code of the file wp-settings.php
.
The function wp_get_active_and_valid_plugins()
loads plugins for individual sites in the network and for non-Multi-Site installations, while wp_get_active_network_plugins()
loads network activated plugins when Multi-Site is enabled.
The former more or less just calls get_option() to get the active_plugins
option from the wp_options database table, while the latter uses get_site_option() which is the network-wide version of get_option()
. The option which has the network enabled plugins is called active_sitewide_plugins
.