The plugin_install_action_links WordPress PHP filter allows you to modify the action links displayed on the plugin installation page.
Usage
add_filter('plugin_install_action_links', 'customize_plugin_install_action_links', 10, 2); function customize_plugin_install_action_links($action_links, $plugin) { // your custom code here return $action_links; }
Parameters
$action_links
(string[]): An array of plugin action links. Defaults are links to Details and Install Now.$plugin
(array): An array of plugin data. See plugins_api() for the list of possible values.
More information
See WordPress Developer Resources: plugin_install_action_links
Examples
Change the Install Now link text
Modify the ‘Install Now’ link text to ‘Get Plugin’.
add_filter('plugin_install_action_links', 'change_install_now_link_text', 10, 2); function change_install_now_link_text($action_links, $plugin) { $action_links[1] = str_replace('Install Now', 'Get Plugin', $action_links[1]); return $action_links; }
Add a custom link to the plugin installation page
Add a ‘View Documentation’ link to each plugin installation page.
add_filter('plugin_install_action_links', 'add_documentation_link', 10, 2); function add_documentation_link($action_links, $plugin) { $documentation_link = '<a href="https://example.com/docs/" target="_blank">View Documentation</a>'; array_push($action_links, $documentation_link); return $action_links; }
Remove the Details link
Remove the ‘Details’ link from the plugin installation page.
add_filter('plugin_install_action_links', 'remove_details_link', 10, 2); function remove_details_link($action_links, $plugin) { unset($action_links[0]); return $action_links; }
Change the order of action links
Swap the order of the ‘Details’ and ‘Install Now’ links on the plugin installation page.
add_filter('plugin_install_action_links', 'swap_action_links_order', 10, 2); function swap_action_links_order($action_links, $plugin) { $temp = $action_links[0]; $action_links[0] = $action_links[1]; $action_links[1] = $temp; return $action_links; }
Add a custom CSS class to the Install Now link
Add a custom CSS class to the ‘Install Now’ link.
add_filter('plugin_install_action_links', 'add_custom_css_class', 10, 2); function add_custom_css_class($action_links, $plugin) { $action_links[1] = str_replace('<a', '<a class="custom-css-class"', $action_links[1]); return $action_links; }