Adding Plugin Action Links
Plugin action links are the links that appear just below the plugin name in your WP plugins menu, such as “Edit” and “Activate”. Have you ever seen those plugins that have somehow added additional links to that list, such as “Settings” or “Donate”? It’s actually quite simple.
First, we are going to create a function that will display our links.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | function our_plugin_action_links($links, $file) { static $this_plugin; if (!$this_plugin) { $this_plugin = plugin_basename(__FILE__); } // check to make sure we are on the correct plugin if ($file == $this_plugin) { // the anchor tag and href to the URL we want. For a "Settings" link, this needs to be the url of your settings page $settings_link = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=font-uploader.php">Settings</a>'; // add the link to the list array_unshift($links, $settings_link); } return $links; } |
This function isn’t overly complex, but it’s not extremely simple either. Basically, we do a check to ensure we’re on the right plugin, then we provide a little HTML (the anchor tag) for our link, and then, finally, we add the new link to the list of existing links.
Next, we just need to run our function through a filter, which will make out link actually appear.
1 | add_filter('plugin_action_links', 'our_plugin_action_links', 10, 2); |
And the result should look something like this:
Enjoy!


Showing 4 Comments
Dalton
Thanks, this is a nice tip and something I’ve been wanting to add to my plugins.
REPLY 802 days agoPippin (Admin)
Great, glad it was helpful.
REPLY 802 days agoDaniel
Thanks for the info! This site is very nice – will save it.
REPLY 802 days agoauntypizza
Nice post … I have got the link appearing but now what.
REPLY 340 days agoObviously when I click on the Settings link nothing will happen (although I get “You do not have sufficient permissions to access this page.”)
Â
Can you continue this post explaining how to actually add the settings CONTENTS.
That would be great.
Â
I have scoured the net for hours looking for help with this but nothing so far.