Guy Schaller
Guy Schaller

Reputation: 4700

wordpress, adding a settings action link under my plugin's name for my plugin

I'm trying to develop my first plugin for wordpress. I noticed that other plugins I have installed on my wordpress have a link to the plugin setting page right from the plguin page list of plugins.

so right under my plugin's name I see:

Deactivate

but for some of my other plugins I also see a

Settings

link that will take the user right to the settings page of that plugin. How can I tell wordpress I want such a link for my plugin?

I use this hook to add my settings page:

add_action('admin_menu', 'my_plugin_admin_add_page');

thanks

Upvotes: 0

Views: 603

Answers (1)

Anoop Asok
Anoop Asok

Reputation: 1337

Please add the following code to the plugin file.

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

function my_plugin_settings( $settings ) {
   $settings[] = '<a href="'. get_admin_url(null, 'settings.php') .'">Settings</a>';
   return $settings;
}

Upvotes: 1

Related Questions