Whenever you’re building a plugin that introduces a submenu, and you’re using the proper APIs, you’re going to be creating an administration page (whether or not it has settings).
When doing this, though, you can also introduce a plugin settings link. These are the links that appear under the name of the plugin from in the plugin dashboard.
If your plugin introduces its submenu item, then it likely introduces its own settings page. And if you’re looking to associate this page with your plugin settings link, it’s really easy to do.
Plugin Settings Link
First, it may be helpful to review the plugin_action_links hook that WordPress provides.
As the Codex states:
Applied to the list of links to display on the plugins page (beside the activate/deactivate links).
From there, you’ll need to define your function and then create a link to the settings page.
All you need to know is the following:
- the callback function accepts an array of the links it’s going to render,
- the URL to your settings page
From there, you simply add a link to your plugin settings page and add the link to the incoming array. Then you return that array to WordPress.
And that’s it.
If you want to change where the link is located, you can place it elsewhere in the array using one of the many PHP array functions (or even changing where it’s specified in the function above (first or last).
From here, though, the plugin settings link will appear in the plugin page in the WordPress administration area.