plugin_row_metafilter-hookWP 2.8.0

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:

Array (
	[id] => w.org/plugins/query-monitor
	[slug] => query-monitor
	[plugin] => query-monitor/query-monitor.php
	[new_version] => 3.5.2
	[url] => https://wordpress.org/plugins/query-monitor/
	[package] => https://downloads.wordpress.org/plugin/query-monitor.3.5.2.zip
	[icons] => Array
		(
			[2x] => https://ps.w.org/query-monitor/assets/icon-256x256.png?rev=2056073
			[1x] => https://ps.w.org/query-monitor/assets/icon.svg?rev=2056073
			[svg] => https://ps.w.org/query-monitor/assets/icon.svg?rev=2056073
		)

	[banners] => Array
		(
			[2x] => https://ps.w.org/query-monitor/assets/banner-1544x500.png?rev=1629576
			[1x] => https://ps.w.org/query-monitor/assets/banner-772x250.png?rev=1731469
		)

	[banners_rtl] => Array
		(
		)

	[Name] => Query Monitor
	[PluginURI] => https://querymonitor.com/
	[Version] => 3.5.2
	[Description] => The developer tools panel for WordPress.
	[Author] => John Blackbourn
	[AuthorURI] => https://querymonitor.com/
	[TextDomain] => query-monitor
	[DomainPath] => /languages/
	[Network] =>
	[RequiresWP] =>
	[RequiresPHP] => 5.3.6
	[Title] => Query Monitor
	[AuthorName] => John Blackbourn
)
$status(string)

Current tab in the Plugins list. Possible values:

  • all
  • active
  • inactive
  • recently_activated
  • upgrade
  • mustuse
  • dropinss
  • search

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

WP_Plugins_List_Table::single_row()
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 );

Where the hook is used in WordPress

Usage not found.