
Setting links are a great and easy way to provide shortcuts to your users.
Here are a few that I’ve included as part of my plugins.


Starting With Initialization

Let’s start with your main plugin file. I first add in a namespace, simply because prefixing functions is the wild west.
namespace DLXPlugins\DLXPluginSettingLinks;
Code language: PHP (php)
Since adding setting links requires a reference to the main plugin file, I usually add a constant which I can reference later.
In the above example, I use the following snippet to create my file reference:
define( 'HIGHLIGHT_AND_SHARE_FILE', __FILE__ );
Code language: PHP (php)
This HIGHLIGHT_AND_SHARE_FILE
constant will be used to reference my main plugin file. This is extremely useful if you have multiple plugin files that are not in the plugin root.
Adding Plugin Setting Links
To keep this simple, we’ll just include everything in the main plugin file. We’ll start by calling a filter so that we can add in our own setting links.
add_filter(
'plugin_action_links_' . plugin_basename( DLX_PLUGIN_SETTING_LINKS ),
'DLXPlugins\DLXPluginSettingLinks\add_settings_links'
);
Code language: PHP (php)
We start with the prefix plugin_action_links_
. After that, append the plugin’s basename and pass it a reference to the main plugin file.
Add a callback called add_settings_links
, which we’ll use in the next example. Note that I used the namespace for the callback function.
/**
* Callback for plugin_action_links
*
* @param array $links Array of links.
*
* @return array updated links.
*/
function add_settings_links( $links ) {
$docs_link = '<a href="https://docs.dlxplugins.com" target="_blank">Docs</a>';
array_push( $links, $docs_link );
return $links;
}
Code language: PHP (php)
You should end up with a new docs setting link, as shown in the screenshot below.

If you’d like docs to show up before Deactivate, use array_unshift
instead of array_push
.
/**
* Callback for plugin_action_links
*
* @param array $links Array of links.
*
* @return array updated links.
*/
function add_settings_links( $links ) {
$docs_link = '<a href="https://docs.dlxplugins.com" target="_blank">Docs</a>';
//array_push( $links, $docs_link );
array_unshift( $links, $docs_link );
return $links;
}
Code language: PHP (php)

Want to add color and formatting? Just add inline styles.
/**
* Callback for plugin_action_links
*
* @param array $links Array of links.
*
* @return array updated links.
*/
function add_settings_links( $links ) {
$docs_link = '<a href="https://docs.dlxplugins.com" target="_blank" style="color: green; font-weight: 600">Docs</a>';
//array_push( $links, $docs_link );
array_unshift( $links, $docs_link );
return $links;
}
Code language: PHP (php)

Adding Setting Links to Multisite
For multisite, you’d follow the steps above, but instead would use network_admin_plugin_action_links_
as the prefix.
Here’s an example in the wild:

That’s it!
In this short tutorial, I explained how to add setting links, how to adjust the priority, how to customize the appearance, and also how to do it with multisite.
Please leave any questions and I’ll be sure to answer them.
View the Source Code
Would you like more tutorials like this?
Just sign up below.

Ronald Huereca founded DLX Plugins in 2022 with the goal of providing deluxe plugins available for download. Find out more about DLX Plugins, check out some tutorials, and check out our plugins.