WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking to get meta data about an installed plugin from another plugin. Theoretically, to get the version, I could do:

$data = get_plugin_data( 'expected_plugin_folder_name');
$version = $data['version'];

But, this wouldn't work if the end user had changed the name of the plugin that I'm looking to get the meta data on was installed in.

I think the solution is to search in the array returned from get_plugins(). The sticky part is the array keys are named for the path, relative to the plugin directory of the plugin file, which brings me back to the same issue as before--the end-user might have changed the directory name of the plugin.

Is there anyway to get the meta data without having to specify the plugin folder? Possibly by specifying slug, uri, name, etc...

share|improve this question
Do you know a function name from the plugin’s main file? – toscho Nov 30 '13 at 19:40

If you know a function or class of the plugin’s main file, you can use the Reflection API.

Example with my plugin T5 Taxonomy Location

add_action( 'plugins_loaded', function()
    $class = 'T5_Taxonomy_Location';

    if ( ! class_exists( $class ) )

    add_action( 'admin_footer', function() use ( $class )
        $reflection = new ReflectionClass( $class );
        $file       = $reflection->getFileName();
        $data       = get_plugin_data( $file );

        print '<pre>$data = ' . esc_html( var_export( $data, TRUE ) ) . '</pre>';


$data = array (
  'Name' => 'T5 Taxonomy Location',
  'PluginURI' => 'https://github.com/toscho/t5-taxonomy-location',
  'Version' => '2012.09.11',
  'Description' => 'Creates a new taxonomy for locations. <cite>By <a href="http://toscho.de" title="Visit author homepage">Thomas Scholz </a>.</cite>',
  'Author' => '<a href="http://toscho.de" title="Visit author homepage">Thomas Scholz </a>',
  'AuthorURI' => 'http://toscho.de',
  'TextDomain' => 'plugin_t5_tax_location',
  'DomainPath' => '/languages',
  'Network' => false,
  'Title' => '<a href="https://github.com/toscho/t5-taxonomy-location" title="Visit plugin homepage">T5 Taxonomy Location</a>',
  'AuthorName' => 'Thomas Scholz ',

For a function, use ReflectionFunction. It inherits the method getFileName() too.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.