Accessing Active Plugins from Multiple Databases
Within WordPress, a common requirement is retrieving information stored across multiple databases, such as querying active plugins. The active_plugins settings are typically stored in the wp_options table within each individual database.
To retrieve all active plugin settings from multiple databases, utilize the UNION operator. The following SQL query demonstrates how:
SELECT option_value FROM `database1`.`wp_options` WHERE option_name="active_plugins" UNION SELECT option_value FROM `database2`.`wp_options` WHERE option_name="active_plugins"
This query combines the results from both database1 and database2 into a single result set, providing a comprehensive list of active plugins across all databases.
The above is the detailed content of How to Retrieve Active Plugin Lists from Multiple WordPress Databases?. For more information, please follow other related articles on the PHP Chinese website!