Last active
January 10, 2023 01:39
-
-
Save damiencarbery/ac356e46341857eb98a30e8b2d5c3b77 to your computer and use it in GitHub Desktop.
List name, version and description of active plugins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
// Restrict who can access this script. | |
$permitted_ips = array('12.34.56.78', ); | |
if (in_array($_SERVER['REMOTE_ADDR'], $permitted_ips) == false) { | |
header('HTTP/1.0 403 Forbidden'); | |
die(); | |
} | |
*/ | |
?> | |
<!DOCTYPE html> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>List Active Plugins</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
</head> | |
<body> | |
<h1>List Active Plugins</h1> | |
<?php | |
$csv_output = true; // Set to false for html style. | |
define('WP_USE_THEMES', false); | |
/** Loads the WordPress Environment and Template */ | |
require( dirname( __FILE__ ) . '/wp-blog-header.php' ); | |
// Check if get_plugins() function exists. This is required on the front end of the | |
// site, since it is in a file that is normally only loaded in the admin. | |
if ( ! function_exists( 'get_plugins' ) ) { | |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
} | |
$all_plugins = get_plugins(); | |
$active_plugins = get_option('active_plugins'); | |
if ( $csv_output ) { echo '<pre>'; } | |
foreach ( $active_plugins as $index => $plugin ) { | |
if ( array_key_exists( $plugin, $all_plugins ) ) { | |
//var_export( $all_plugins[ $plugin ] ); | |
if ( $csv_output ) { | |
echo join( "\t", array( $all_plugins[ $plugin ][ 'Name' ], $all_plugins[ $plugin ][ 'Version' ], $all_plugins[ $plugin ][ 'Description' ] ) ), "\n"; | |
} else { | |
echo '<h2>', $all_plugins[ $plugin ][ 'Name' ], ' ('. $all_plugins[ $plugin ][ 'Version' ] .')</h2>'; | |
echo '<p>', $all_plugins[ $plugin ][ 'Description' ], '</p>'; | |
} | |
} | |
} | |
if ( $csv_output ) { echo '</pre>'; } | |
?> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array ( | |
'Name' => 'Events Manager', | |
'PluginURI' => 'http://wp-events-plugin.com', | |
'Version' => '5.8.1.1', | |
'Description' => 'Event registration and booking management for WordPress. Recurring events, locations, google maps, rss, ical, booking registration and more!', | |
'Author' => 'Marcus Sykes', | |
'AuthorURI' => 'http://wp-events-plugin.com', | |
'TextDomain' => 'events-manager', | |
'DomainPath' => '', | |
'Network' => false, | |
'Title' => 'Events Manager', | |
'AuthorName' => 'Marcus Sykes', | |
) |
nemanjaradevic
commented
Apr 18, 2021
via email
Is there step by step instructions i could follow
I would like to get all installed plugins in json or csv and download
I m not a dev but i have 15 years hands on experience just a few steps,
what code and where it would be great
…On Sun, Apr 18, 2021, 14:40 Damien Carbery ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
it not working
It is working for me. I tried it on a site running WordPress 5.7.1 with 38
active plugins.
Note: This code is *not* a plugin file. It must be uploaded to the root
directory (the same directory as wp-blog-header.php).
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<https://gist.github.com/ac356e46341857eb98a30e8b2d5c3b77#gistcomment-3710154>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACFSLZG6EY6QVARXLHTEVBLTJLAKDANCNFSM43DGCGHQ>
.
Is there step by step instructions i could follow I would like to get all installed plugins in json or csv and download I m not a dev but i have 15 years hands on experience just a few steps, what code and where it would be great
I have updated the code to create a CSV output (tab separated because some plugin descriptions contain commas).
If you want the previous format then change the line
$csv_output = true;
to $csv_output = false;
Upload the file to the root directory of your website and then access https://example.com/list-active-plugins.php
When you are finished please delete the file because it is a security hole (it has full access to the WordPress site without needing a password).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment