If you’ve ever built a custom plugin for yourself or for someone else, then you’ve likely done something with the WordPress plugin links even if it’s just providing author information a URL to the homepage for the plugin.
And you know what I’m talking about: These are the links that appear below the name of the plugin.
According to the code reference, this information is:
The plugin’s metadata, including the version, author, author URI, and plugin URI.
Occasionally, though, you may find that you want to add or modify the links. That is, you can add your own custom links to appear in the list below.
WordPress Plugin Links
In core, the WordPress plugin links are referred to as the plugin meta row (or perhaps the plugin metadata row would be more appropriate).
Regardless, it’s an array of information that’s assembled them rendered on the front-end whenever WordPress wants to showcase something. You can add custom information quickly by doing something like this:
But this leaves a couple of things to be desired. Namely:
- there’s no security around the markup (and perhaps you could make a case there doesn’t need to be if you’re the one in charge of it),
- there’s no accessibility around the anchor,
To mitigate this, the code can be updated to this:
And if you really want to get creative, you can use PHP’s array_splice method to place the HTML wherever you want. On top of that, you may want to add a guard clause for a specific plugin by using something like:
And checking the value of the result. Simply just return the incoming array if it’s not equal to the name of your plugin.
This is outside the scope of what we’re aiming to do, though. The above should be enough to get you started.