How to set meta-data for my plugin

I found this snippet of code to retrieve data for a single plugin, within the wp-admin:

$plugin_data = get_plugin_data( __FILE__, $markup = true, $translate = true );
foreach($plugin_data as $k=>$v){
echo $k . ” = ” . $v . “<br>”;
}

It works to the extent that an associative array is output, but only one of the keys, ‘TextDomain’ actually has a value. I assume I’m supposed to set the values somewhere, and I thought that would be in the plugin commented header.

Here’s the output from the foreach loop:

PluginURI =
Version =
Description =
Author =
AuthorURI =
TextDomain = custom-calculator
DomainPath =
Network =
Title =
AuthorName =

Here’s my header in the main plugin file:

/*
Plugin Name: Custom Calculator
Plugin URI: http://customcalc.com
Description: A cost calculator.
Version: 1.2
Author: John Doe
Author URI:
License: Commercial Single License
License URI:
Text Domain: cost-calculator
Domain Path: /languages
*/

How do I set/access the values for the other fields, everything from PluginURI to Version, Description, Author, AuthorURI, Title, etc?

Read more here:: How to set meta-data for my plugin

Leave a Reply

Your email address will not be published. Required fields are marked *