After seeing thousands of useful API functions in the WordPress core, I'm surprised to discover today that there ain't a function that would list the active plug-ins. I don't know you but I'm quite surprised at that.

I was wondering if there is a reason for missing that? If so, I'd like to know about it.

And, if there is a quick PHP snippet you know of that could give you a list of active plugins, ( the same way that a get_post_types('','names'); does for CPT's or get_taxonomies('','names'); does for CTs ), I'd appreciate it if you provide the code.

3 Answers 3




and get_option('active_plugins')

  • Interesting. So we do have such a function. That's good. But check this (google.com/… ) or this (google.com/…) to see how google fails to pick that up. May 15, 2012 at 12:22

There multiple WordPress Apis for getting a list of plugins like OTP listed in his answer.

get_plugins() :Check the plugins directory and retrieve all plugin files with plugin data. Returns an array. Note: Only works on the admin side


function list_the_plugins() {
    $plugins = get_plugins();
        foreach ( $plugins as $plugin ) {
        var_dump( $plugin );


  'Name' => string 'WP Coda Slider' (length=14)
  'PluginURI' => string 'http://c3mdigital.com/wp-coda-slider/' (length=37)
  'Version' => string '0.3.2' (length=5)
  'Description' => string 'Add a jQuery Coda slider to any WordPress post or page' (length=54)
  'Author' => string 'c3mdigital' (length=10)
  'AuthorURI' => string 'http://c3mdigital.com/' (length=22)
  'TextDomain' => string '' (length=0)
  'DomainPath' => string '' (length=0)
  'Network' => boolean false
  'Title' => string 'WP Coda Slider' (length=14)
  'AuthorName' => string 'c3mdigital' (length=10)

get_option( 'active_plugins' ) Returns the path relative to wp-content/plugins of the plugin file:


function list_the_plugins() {
    $plugins = get_option ( 'active_plugins', array () );
    foreach ( $plugins as $plugin ) {
        echo "<li>$plugin</li>";


  • debug-bar-extender/debug-bar-extender.php
  • debug-bar/debug-bar.php
  • log-deprecated-notices/log-deprecated-notices.php
  • manage-post-schedule/manage-post-schedule.php
  • wp-coda-slider/wpcodaslider.php

Other API functions related to plugin status:


I recently had to get 2 seperate lists, active and inactive plugins. This is what i came up with:

$plugins = get_plugins();
$activated_plugins = array();
$deactivated_plugins = array();
foreach($plugins as $key => $val){
        array_push($deactivated_plugins, $key);
    } else {
        array_push($activated_plugins, $key);
echo '<pre>'; print_r($deactivated_plugins); echo '</pre>';
echo '<pre>'; print_r($activated_plugins); echo '</pre>';

Will print 2 seperate arrays of active and inactive plugins.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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