我想使用以下API检查插件版本
https://api.wordpress.org/stats/plugin/1.0/{slug}
为此,我如何才能获得所有活动插件的Slug?我想使用以下API检查插件版本
https://api.wordpress.org/stats/plugin/1.0/{slug}
为此,我如何才能获得所有活动插件的Slug?您可以使用以下代码:
<?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如果您不在多站点安装上,则可以使用以下代码激活插件:
$active_plugins = get_option( \'active_plugins\', array() );
我正在开发一个网站,最终将有一个副本,一个单独的WP安装在另一种语言。我在这个网站上有一些自定义帖子类型,其中一些带有用于存档页面和/或单发帖子的自定义slug。我想知道我是否可以使用自定义管理页面中的选项来执行此操作?这种方法有什么缺陷吗?因此,我将定义一个在WP Admin中使用的自定义选项: class MySettingsPage { private $options; public function __construc