Skip to content

Instantly share code, notes, and snippets.

@facelordgists
Created May 1, 2019 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save facelordgists/5d60a41118faaf97f9136a83cf21608b to your computer and use it in GitHub Desktop.
Save facelordgists/5d60a41118faaf97f9136a83cf21608b to your computer and use it in GitHub Desktop.
<?php
function get_all_plugin_data(){
$all_plugins = get_plugins();
$list_of_all_plugins = array();
foreach ($all_plugins as $path => $data) {
$parts = explode('/', $path);
$slug = $parts[0];
$list_of_all_plugins[$slug] = array(
'Slug' => $slug,
'path' => $path,
'Name' => $data['Name'],
'Version' => $data['Version'],
'Description' => $data['Description'],
'Author' => $data['Author'],
'AuthorURI' => $data['AuthorURI'],
'Status' => (is_plugin_active($path) ? 'active' : 'inactive'),
);
}
return $list_of_all_plugins;
}
/* Sample item
[wordpress-seo] => Array(
[Slug] => wordpress-seo
[path] => wordpress-seo/wp-seo.php
[Name] => Yoast SEO
[Version] => 9.6
[Description] => The first true all-in-one SEO solution for WordPress, including on-page content analysis, XML sitemaps and much more.
[Author] => Team Yoast
[AuthorURI] => https://yoa.st/1uk
[Status] => active
)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment