plugin_row_meta
Allows you to change the metadata (link, version, and so on) displayed for each plugin in the Plugins table.
Example metadata (version, author, details) for the Query Monitor plugin:
Usage
add_filter( 'plugin_row_meta', 'wp_kama_plugin_row_meta_filter', 10, 4 );
/**
* Function for `plugin_row_meta` filter-hook.
*
* @param string[] $plugin_meta An array of the plugin's metadata, including the version, author,
* author URI, and plugin URI.
* @param string $plugin_file Path to the plugin file relative to the plugins directory.
* @param array $plugin_data An array of plugin data.
* @param string $status Status filter currently applied to the plugin list. Possible values
* are: 'all', 'active', 'inactive', 'recently_activated', 'upgrade',
* 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled',
* 'auto-update-disabled'.
*
* @return string[]
*/
function wp_kama_plugin_row_meta_filter( $plugin_meta, $plugin_file, $plugin_data, $status ){
// filter...
return $plugin_meta;
}
- $plugin_meta(array)
Elements displayed in the plugin data (the table row below the plugin description). This is normally where a custom element is added. For example:
Array ( [0] => Version 3.5.2 [1] => By <a href="https://querymonitor.com/">John Blackbourn</a> [2] => <a href="https://example.com/wp-admin/plugin-install.php?tab=plugin-information&plugin=query-monitor&TB_iframe=true&width=600&height=550" class="thickbox open-plugin-details-modal" aria-label="More information about Query Monitor" data-title="Query Monitor">View details</a> )
- $plugin_file(string)
- Path to the plugin file relative to the plugins directory. For example:
query-monitor/query-monitor.php. - $plugin_data(array)
Plugin data. For example:
- $status(string)
Current tab in the Plugins list. Possible values:
allactiveinactiverecently_activatedupgrademustusedropinsssearch
Default: 'all'
Examples
#1 Add a donation page link to the plugin data
Code from the Featured Image Generator plugin:
add_filter( 'plugin_row_meta', 'fig_add_plugin_row_meta', 10, 2);
function fig_add_plugin_row_meta($meta, $file) {
if ($file == plugin_basename( __FILE__ )) {
$meta[] = '<a href="https://www.paypal.me/watcharapon/0usd" target="_blank">Donate</a>';
}
return $meta;
}Changelog
| Since 2.8.0 | Introduced. |
Where the hook is called
plugin_row_meta
wp-admin/includes/class-wp-plugins-list-table.php 1341
$plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status );