plugin_action_links_{$plugin_file}

最后更新于:2021-11-27 14:40:21

apply_filters( “plugin_action_links_{$plugin_file}”, string[] $actions, string $plugin_file, array $plugin_data, string $context )

Filters the list of action links displayed for a specific plugin in the Plugins list table.

参数

$actions

(string[])
An array of plugin action links. By default this can include ‘activate’, ‘deactivate’, and ‘delete’. With Multisite active this can also include ‘network_active’ and ‘network_only’ items.

$plugin_file

(string)
Path to the plugin file relative to the plugins directory.

$plugin_data

(array)
An array of plugin data. See get_plugin_data().

$context

(string)
The plugin context. By default this can include ‘all’, ‘active’, ‘inactive’, ‘recently_activated’, ‘upgrade’, ‘mustuse’, ‘dropins’, and ‘search’.

add_filter( 'plugin_action_links', 'ttt_gcmdr_add_action_plugin', 10, 5 );

function ttt_gcmdr_add_action_plugin( $actions, $plugin_file ) 
{
   static $plugin;

   if (!isset($plugin))
		$plugin = plugin_basename(__FILE__);
   if ($plugin == $plugin_file) {

      $settings = array('settings' => '<a href="https://docs.gechiui.com/hooks/plugin_action_links_plugin_file/options-general.php">' . __('Settings', 'General') . '</a>');
      $site_link = array('support' => '<a href="http://thetechterminus.com" target="_blank">Support</a>');
		
      $actions = array_merge($settings, $actions);
      $actions = array_merge($site_link, $actions);
   }
	
   return $actions;
}

源文件

文件: gc-admin/includes/class-gc-plugins-list-table.php

View on Trac