Just another Websupporter site

Add additional links on the plugins overview page

You know the usual plugin overview page. You have a small description of the plugins, the version, the author, a link to the plugins page and so on. On the left side, you will find the activation and deactivation links as well as the edit links. But from time to time, you will find plugins, which added a settings link or something similar to this line.

This is sometimes useful. Especially for plugins which do not need a lot of attention an additional list point in the admin menu is rather disturbing. In such a case a settings link on the plugin overview page is rather useful. But, how do you add such a link?

I searched a bit, how such plugins add these links and I found the filter hook “plugin_action_links“. This filter contains an array of all action links, which are shown on the overview page. Since these links differ from plugin to plugin, you have to adjust the filter for your own plugin by extending the filter name with the basename of your plugin:

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

This filter function accepts now the array of links and you can alter the links as you wish. In my example code, I add a link to my web page:

Embed from pastebin.com

Click the button below to load the content from pastebin.com.

Always allow pastebin.com

But how to create a admin page which doesn’t appear in the menue? You can use add_submenu_page() and define the parent slug as ‘null’:

add_submenu_page( null, 'Title', 'Title', 'manage_options', 'invisible', 'render_function' );

This page can be reached via the URL wp-admin/?page=invisible, so by simply adding the GET-Parameter page with the page slug.

About the author

Seine erste Webseite hat David Remer 1998 in HTML verfasst. Wenig später war er fasziniert von DHTML und JavaScript. Nach jahrelanger Freelancerei arbeitete er zunächst für Inpsyde und ist heute Entwickler bei Automattic. Außerdem hat er das Buch "WordPress für Entwickler" verfasst.

Leave a Reply

Your email address will not be published.