Performance problems with is_required_plugin_active()
-
I had some tough performance issues with a WordPress, so after digging and profiling I’ve found this piece of code that was problematic:
— From ‘/wp-content/plugins/swifty-page-manager/lib/swifty_plugin/php/lib_swifty_plugin_view.php’ —
public static function is_required_plugin_active( $plugin_name )
….
// no then we will find out: get all plugins and look for the plugin name in the
directory nameif( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . ‘wp-admin/includes/plugin.php’;
}
` $keys = array_keys( get_plugins() );The get_plugins function is very very slow and IMHO, an admin function shouldn’t be called in the client application.
This happens every page view, so the system is unstable, crashes with 10 concurrent requests (4 cores, 16 GB) and cannot perform as required.
How can I fix this issue?
- The topic ‘Performance problems with is_required_plugin_active()’ is closed to new replies.