Created
March 4, 2019 00:53
-
-
Save tradesouthwest/f0ef36ae5f43f288443af25e8597c38e to your computer and use it in GitHub Desktop.
This snippet adds a shortcode to wordpress which will list all plugins in your wordpress plugins folder
This file contains hidden or 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 | |
// 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. | |
// This snippet adds a shortcode to wordpress which will list all plugins | |
function tradesouthwest_custom_listtall_plugins() | |
{ | |
if ( ! function_exists( 'get_plugins' ) ) { | |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; | |
} | |
$all_plugins = get_plugins(); | |
header('Content-type: text/plain'); | |
// Save the data to the error log so you can see what the array format is like. | |
echo '<pre>'; print_r($all_plugins); echo '</pre>'; | |
} | |
add_shortcode( 'listall_plugins', 'tradesouthwest_custom_listtall_plugins' ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment