A Settings Link for Your WordPress Plugins

Posted on June 22, 2009  |  Category: Tutorials

If you are developing a WordPress plugin, one of the first things I would suggest is adding a “Settings” link directly on the plugins page. This makes it easier for users to quickly access the plugin’s options page without having to search through the admin menu.

It is pretty simple to do, and only takes a few lines of code.

Add the following to your plugin file, within a <php> tag:

// Add settings link on plugin page
function your_plugin_settings_link($links) {
  $settings_link = 'Settings';
  array_unshift($links, $settings_link);
  return $links;
}

$plugin = plugin_basename(__FILE__);
add_filter("plugin_action_links_$plugin", 'your_plugin_settings_link' );

Be sure to change the your_plugin.php to the actual filename of your plugin.


Tags: , , , , , , , , , , , , , , , , , ,

Short URL: http://bavotasan.com/?p=712

5 Responses to “A Settings Link for Your WordPress Plugins”

  1. if only their were more quality websites like yours on the internet, please keep up the good work.

    #3141
  2. I needed to know how to do exactly this for my upcoming plugin release. Your code worked perfectly! Thank you so much!

    #3741
  3. Hey this is really useful, just wanted to say thanks – this has been added to our FreeLance plugin which we’ll be releasing (relatively) soon!

    #4090
  4. I never really thought about doing this since I’m quite comfortable with the admin menu. It makes things a lot quicker though especially if you frequently change the settings.

    #5576
  5. Thank you, it’s work perfectly for my plugins.
    :)

    #7521

Leave a Reply

To enter code in the comment box, please place it between <pre lang="php"> </pre> tags. You don't have to convert any characters to their hex/HTML code. Just add your code the way you would to any code editor.