Hi Guys,
Before you get confused on what I am going to say or write about let me show you a screenshot that is what we will be discussing in this blog post.
Alright, So see those Links that appear besides my name
- Contact me
- Purchase Pro
We are just going to look at how to do those
The filter that we need to do this is called plugin_row_meta – that is responsible to handle meta links added to the plugin description on the plugin page.
Here is the definition or line of code that you will be including in your plugin file.
1 |
add_filter("plugin_row_meta","my_plugin_link",10 /*priority*/,2/*accepted args*/); |
Now we will write our my_plugin_link function as shown below, remember that accepted arguments for our function is 2, First one is array of Links and second is Plugin file
Function
Now lets check what our filter function looks like
1 2 3 4 5 6 |
function my_plugin_links( $links, $file ) { $links[ ] = '<a href="https://jaspreetchahal.org/contact-me/">Contact me<a>'; $links[ ] = '<a href="http://jaspreetchahal.org/wordpress-coupon-plugin-jc-coupon-revealer-pro/">Purchase Pro<a>'; return $links; } |
And that’s pretty much it. Just add a few more links to that $links array and you will see that they will be appended to the plugin meta links that you see on plugins page.
I hope that this helps you. Just in case the above mentioned code can be improved, leave your comments
Cheers
Leave a Reply