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() 用法



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

默认值: None


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

默认值: true


(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() 源文件