4

Is there any way to get all activated plugin list in wordpress codex .

i used this

get_option('active_plugins');

this return the plugin file path. I want the name. Because sometimes file name is different with the actual plugin name.

Sarwar Hasan
  • 1,561
  • 2
  • 17
  • 25
  • 3
    Hi, please always remember to Google first. A query for `wordpress get list of active plugins` gives a full answer. There is no need to start a new SO question for it. – Pekka Dec 10 '13 at 07:12
  • 3
    See e.g. [How to do I get a list of active plugins on my wordpress blog programmatically?](http://wordpress.stackexchange.com/q/54742) – Pekka Dec 10 '13 at 07:13
  • @Pekka웃 Please read the description. I modified something in description. – Sarwar Hasan Dec 10 '13 at 08:14
  • @Pekka웃 - Searching for "codex list of activated plugins" brings me right here. – JJ Rohrer Jun 09 '15 at 19:19

1 Answers1

8

I got the answer

$apl=get_option('active_plugins');
$plugins=get_plugins();
$activated_plugins=array();
foreach ($apl as $p){           
    if(isset($plugins[$p])){
         array_push($activated_plugins, $plugins[$p]);
    }           
}
//This is the $activated_plugins information
Sarwar Hasan
  • 1,561
  • 2
  • 17
  • 25
  • 3
    `get_plugins()` needs a `require_once(ABSPATH . 'wp-admin/includes/plugin.php');` or you'll get a Fatal Error calling it in the front end. – DrLightman Sep 28 '19 at 14:14