Automattic\WooCommerce\Blueprint\Importers
ImportInstallPlugin::get_installed_plugins_paths
Retrieves an array of installed plugins and their paths.
Method of the class: ImportInstallPlugin{}
No Hooks.
Returns
Array. Array of installed plugins and their paths.
Usage
// protected - for code of main (parent) or child class $result = $this->get_installed_plugins_paths();
ImportInstallPlugin::get_installed_plugins_paths() ImportInstallPlugin::get installed plugins paths code WC 10.8.1
protected function get_installed_plugins_paths() {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
$installed_plugins = array();
foreach ( $plugins as $path => $plugin ) {
$path_parts = explode( '/', $path );
$slug = $path_parts[0];
$installed_plugins[ $slug ] = $path;
}
return $installed_plugins;
}