WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/plugin action links (plugin file name)

Contents

Description

Applied to the list of links to display on the plugins page (beside the activate/deactivate links).

Basic Example

add_filter accepts two parameters, one for the name of the filter (plugin_action_links) and one for the function to callback (add_action_links).

add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'add_action_links' );

function add_action_links ( $links ) {
 $mylinks = array(
 '<a href="' . admin_url( 'options-general.php?page=myplugin' ) . '">Settings</a>',
 );
return array_merge( $links, $mylinks );
}

Example

When the 'plugin_action_links_(plugin file name)' filter is called, it is passed one parameter: the links to show on the plugins overview page in an array.

The (plugin file name) placeholder stands for the plugin name that you can normally get from the magic constant __FILE__.

add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'my_plugin_action_links' );

function my_plugin_action_links( $links ) {
   $links[] = '<a href="'. get_admin_url(null, 'options-general.php?page=gpaisr') .'">Settings</a>';
   $links[] = '<a href="http://wp-buddy.com" target="_blank">More plugins by WP-Buddy</a>';
   return $links;
}

Will result in something like this: Plugin Action Links Filter Example

Source File

Triggered in wp-admin/includes/class-wp-plugins-list-table.php

Related

Filters

This page is marked as incomplete. You can help Codex by expanding it.