您可以使用以下代码:
<?php
// Check if get_plugins() function exists. This is required on the front end of the
// site, since it is in a file that is normally only loaded in the admin.
if ( ! function_exists( \'get_plugins\' ) ) {
require_once ABSPATH . \'wp-admin/includes/plugin.php\';
}
$all_plugins = get_plugins();
print_r( $all_plugins);
结果:
Array
(
[hello-dolly/hello.php] => Array
(
[Name] => Hello Dolly
[PluginURI] => http://wordpress.org/extend/plugins/hello-dolly/
[Version] => 1.6
[Description] => This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
[Author] => Matt Mullenweg
[AuthorURI] => http://ma.tt/
[TextDomain] =>
[DomainPath] =>
[Network] =>
[Title] => Hello Dolly
[AuthorName] => Matt Mullenweg
)
参考号:
https://codex.wordpress.org/Function_Reference/get_plugins