WordPress: Add plugin settings link to Plugins page

When creating a plugin that has its own settings page, it’s frequently helpful to make a connection to the settings page straight from the Plugins list – this spares clients the time it takes to discover where precisely your module shows up in the administrator menu. Here is a basic code scrap that makes the settings interface for you.

<?php
function plugin_add_settings_link( $links ) {
    $settings_link = '<a href="options-general.php?page=plugin_name">' . __( 'Settings' ) . '</a>';
    array_push( $links, $settings_link );
  	return $links;
}
$plugin = plugin_basename( __FILE__ );
add_filter( "plugin_action_links_$plugin", 'plugin_add_settings_link' );
?>

Just replace the href attribute with the link to the plugin settings page and rename the function to something slightly more unique.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s