Skip to content

Instantly share code, notes, and snippets.

@hsleonis
Created April 3, 2016 11:59
Show Gist options
  • Select an option

  • Save hsleonis/388b0b76cd6983a345c5b861151acb26 to your computer and use it in GitHub Desktop.

Select an option

Save hsleonis/388b0b76cd6983a345c5b861151acb26 to your computer and use it in GitHub Desktop.
Parse the plugin contents to retrieve plugin's metadata
<?php
/**
* Parse the plugin contents to retrieve plugin's metadata
* Works only in wp-admin
* Reference: https://codex.wordpress.org/Function_Reference/get_plugin_data
*/
get_plugin_data( $plugin_file, $markup = true, $translate = true );
/*
Return value:
$default_headers = array(
'Name' => 'Plugin Name',
'PluginURI' => 'Plugin URI',
'Version' => 'Version',
'Description' => 'Description',
'Author' => 'Author',
'AuthorURI' => 'Author URI',
'TextDomain' => 'Text Domain',
'DomainPath' => 'Domain Path',
'Network' => 'Network',
// Site Wide Only is deprecated in favor of Network.
'_sitewide' => 'Site Wide Only',
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment