Jun
22
2009

A Settings Link for Your WordPress Plugins


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 = '<a href="options-general.php?page=your_plugin.php">Settings</a>'; 
  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.

If you liked this, please share it.

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

Short URL: http://bit.ly/b1Wt9R

Discussion 7 Comments

  1. hair extensions london on June 28, 2009 at 2:08 pm

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

  2. Alison Barrett on August 9, 2009 at 6:44 pm

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

  3. Richard Tape on August 31, 2009 at 7:22 am

    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!

  4. Work from Home MLM on October 22, 2009 at 9:10 am

    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.

  5. takien on February 4, 2010 at 12:34 am

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

  6. Schrumpfschlauch on April 28, 2010 at 9:34 am

    Yea, don’t forget the link to your plugin page. This is right… Thx for this and bye and good luck

  7. Indonesia Forum on August 8, 2010 at 4:08 am

    it works..!
    thankyou..

Leave a Reply

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

*


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.