Skip to content

How to verify that a specific plugin is installed and/or activated? #3476

Answered by dgw
jeffshead asked this question in Q&A
Discussion options

You must be logged in to vote

You will need to know the full path to the plugin file. These functions can help get the available plugins (with info) and check if a specific plugin is active:

/**
* List plugins in /user/plugins
*
* @return array Array of [/plugindir/plugin.php]=>array('Name'=>'Ozh', 'Title'=>'Hello', )
*/
function yourls_get_plugins() {
$plugins = (array)glob( YOURLS_PLUGINDIR.'/*/plugin.php' );
if ( is_array( $plugins ) ) {
foreach ( $plugins as $key => $plugin ) {
$plugins[ yourls_plugin_basename( $plugin ) ] = yourls_get_plugin_data( $plugin );
unset( $plugins[ $key

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by LeoColomb
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants