Skip to content

Instantly share code, notes, and snippets.

@allysonsouza
Last active May 12, 2023 19:02
Show Gist options
  • Save allysonsouza/7db8c0a49e506ddcbed25cb977b44744 to your computer and use it in GitHub Desktop.
Save allysonsouza/7db8c0a49e506ddcbed25cb977b44744 to your computer and use it in GitHub Desktop.
[Plugin Show Dirname] Display WordPress plugin directory name in plugin list view, making easier to identify plugins with same name, useful when you want to have installed multiple versions of same plugin to easily switch activation
<?php
/**
* Plugin Name: Plugin Show Dirname
* Description: Display WordPress plugin directory name in plugin list view, making easier to identify plugins with same name, useful when you want to have installed multiple versions of same plugin to easily switch activation
* Plugin URI:
* Version: 1.0
* Author: Allyson
* Author URI: https://allysonsouza.com.br
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
*/
add_filter(
'plugin_row_meta',
function ($plugin_meta, $plugin_file) {
$dirname_or_filename = dirname( $plugin_file ) !== '.' ? '📂 ' . dirname( $plugin_file ) : '📄 ' . plugin_basename( $plugin_file );
$plugin_meta[] = "<span><small>$dirname_or_filename</small></span>";
return $plugin_meta;
},
10,
2
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment