Provide a Shortcut to Your Settings Page with Plugin Action Links

When you use this code in your plugin, it will add a ‘Settings’ link to your plugin’s listing under ‘Plugins’. The link will take you to the plugin’s options page.

The benefit of the plugin action link is that users see it immediately after they activate the plugin, thus adding to the overall experience.

add_filter(‘plugin_action_links’, ‘myplugin_plugin_action_links’, 10, 2);

function myplugin_plugin_action_links($links, $file) {
static $this_plugin;

if (!$this_plugin) {
$this_plugin = plugin_basename(__FILE__);

if ($file == $this_plugin) {
// The "page" query string value must be equal to the slug
// of the Settings admin page we defined earlier, which in
// this case equals "myplugin-settings".
$settings_link = ‘<a href="’ . get_bloginfo(‘wpurl’) . ‘/wp-admin/admin.php?page=myplugin-settings">Settings</a>’;
array_unshift($links, $settings_link);

return $links;

If you enjoyed this post, make sure to subscribe to WPMayor’s RSS feed.

About Jean Galea

Jean Galea is a WordPress developer, entrepreneur and padel player. He is the founder of WP Mayor, the plugins WP RSS Aggregator and EDD Bookings, as well as the podcast. His personal blog can be found at

Related Articles

Leave a Reply