Make Additional Links To Display Beside Deactivate/Edit Links In Plugin List Page In WordPress

Hello all ! How are all. Hope everything’s going fine. Today we will discuss about how to add more/additional links to the side of Deactivate | Edit links in plugin list page that we see after activating a plugin



Usually, after activating a plugin we find two links below the plugin name , one is for deactivate the plugin (‘Deactivate’) and the other is for editing (‘Edit’) the plugin. These two are the default links provided by wordpress after plugin activation. When you make,install and activate  your own plugin , you also find these two appeared here. But what if we want to get more links apeared here beside these two? is there a way? In case of many popular plugins, we see extra links there, then why not in case of ours? Well, it’s possible . And in this article i am going to show you how . We will add a ‘settings’ link like the image above in our plugin. 🙂

Let’s get going !

Firstly we should create a plugin. For quick demo i have created one named “Test plugin” in myplugin.php with the following code and saved it in a folder named “testplugin” in wordpress plugin directory.

Plugin Name: Test plugin

Now, let’s activate the plugin in wordpress plugin page. You will see something like this


Now, let’s add the following code ‘myplugin.php’

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>';
   return $links;

Now you will find an extra link named ‘Settings’ like the very first image in this article.

What happened here?

Every plugin has a filter of its own named with its name in this format ‘plugin_action_links_’PLUGIN_NAME. When the plugin is activated, this filter is triggered. We have run a function in this filter that has the array of links passed through it. This array has already two links that are wordpress default ‘Deactivate’ and ‘Edit’ link as its elements. In this function we have done nothing but added one more link as string to that array ($links) and returned that. Pretty cool, not that?

Now like that one we can add more links if we want.

function my_plugin_action_links( $links ) {
   $links[] = '<a href="'. get_admin_url(null, 'options-general.php?page=gpaisr') .'">Settings</a>';
   $links[] = '<a href="'. get_admin_url(null, 'options-general.php?page=asp') .'">More About Me</a>';
   $links[] = '<a href="'. get_admin_url(null, 'options-general.php?page=gps') .'">Official Website</a>';
   return $links;

Now , see the result!



That’s all for now. See you later ! Hope you enjoyed this article, please make a comment and let me know your feelings and share with the world what you knew .

Thank you 🙂

2 responses

Leave a Reply

Your email address will not be published. Required fields are marked *