php wordpress:列出数组中所有已安装的插件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php wordpress:列出数组中所有已安装的插件相关的知识,希望对你有一定的参考价值。

<?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
)
*/

以上是关于php wordpress:列出数组中所有已安装的插件的主要内容,如果未能解决你的问题,请参考以下文章

如何在数组中列出 wordpress 类别 ID 和名称?

php Wordpress - 列出所有(自定义帖子类型)帖子类别

php [Debug enqueue scripts]快速调试,列出所有入队脚本。 #WordPress #enqueue

WordPress页面模板列出所有帖子

列出频道中已安装的软件包

WordPress/PHP 获取主导航中所有链接的列表