get_plugin_data()获取插件的信息

目录

描述

Parse the plugin contents to retrieve plugin's metadata.

The metadata of the plugin's data searches for the following in the plugin's header. All plugin data must be on its own line. For plugin description, it must not have any newlines or only parts of the description will be displayed and the same goes for the plugin data.

Plugin data returned array contains the following:

  • 'Name' - Name of the plugin, must be unique.
  • 'Title' - Title of the plugin and the link to the plugin's web site.
  • 'Description' - Description of what the plugin does and/or notes from the author.
  • 'Author' - The author's name
  • 'AuthorURI' - The authors web site address.
  • 'Version' - The plugin version number.
  • 'PluginURI' - Plugin web site address.
  • 'TextDomain' - Plugin's text domain for localization.
  • 'DomainPath' - Plugin's relative directory path to .mo files.
  • 'Network' - Boolean. Whether the plugin can only be activated network wide.

NOTE This only works in the admin!

get_plugin_data() 描述

用法

<?php get_plugin_data$plugin_file$markup true$translate true ?>

get_plugin_data() 用法

参数

$plugin_file

(string) (必填) Absolute path to the plugin file

默认值: None

$markup

(boolean) (可选) If the returned data should have HTML markup applied

默认值: true

$translate

(boolean) (可选) If the returned data should be translated

默认值: true

get_plugin_data() 参数

返回值

  • array

get_plugin_data() 返回值

历史

添加于 版本: 1.5.0

get_plugin_data() 历史

源文件

get_plugin_data() 函数的代码位于 wp-admin/includes/plugin.php.

get_plugin_data() 源文件

相关