Back to Top

WordPress Add Custom Links Plugin Page

Updated 3 July 2024

WordPress Add Custom Links Plugin Page – In this post we see how we can create additional links to plugin on plugin page. These links can be very useful sometime e.g. we want add some user guide link to plugin. Let’s start with creating test plugin –

<?php

/*
 * Plugin Name: Plugin Additional Links on Plugin Page
 * Description: Add additional links to plugin on plugin page along with meta information.
 * Author: Webkul
 * Author URI: https://webkul.com
 * Version: 1.0
 * Text Domain: domain
*/

The plugin will list on plugin page as shown below –

WordPress Add Custom Links Plugin Page

We will use ‘plugin row meta’ hook and add filter on this hook to add additional links. WordPress provides such types of hooks for various actions so that we can easily customize the templates according to our need. And this is the thing which defines the beauty of WordPress.

So, here we go –

<?php

/*
 * Plugin Name: Plugin Additional Links on Plugin Page
 * Description: Add additional links to plugin on plugin page along with meta information.
 * Author: Webkul
 * Author URI: https://webkul.com
 * Version: 1.0
 * Text Domain: domain
*/

add_filter( 'plugin_row_meta', 'wk_plugin_row_meta', 10, 2 );

function wk_plugin_row_meta( $links, $file ) {    
    if ( plugin_basename( __FILE__ ) == $file ) {
        $row_meta = array(
          'docs'    => '<a href="' . esc_url( 'https://webkul.com/blog/' ) . '" target="_blank" aria-label="' . esc_attr__( 'Plugin Additional Links', 'domain' ) . '" style="color:green;">' . esc_html__( 'Docs', 'domain' ) . '</a>'
        );

        return array_merge( $links, $row_meta );
    }
    return (array) $links;
}

In above code snippet, we can see that we apply one check ‘plugin_basename( __FILE__ ) == $file’. Actually this filter runs in loop for every plugin, Kindly visit the WooCommerce plugins page to explore a wide variety of solutions.

Searching for an experienced
WordPress Company ?
Find out More

So to add link to particular plugin in which we are working we applied check that file should be same as of current plugin then only the link will add otherwise the link will add to every plugin listed on plugin page.

Using above code, We added link named Docs, so let’s see how it will look on plugin page –

WordPress Add Custom Links Plugin Page

Support

Still have any issue feel free to add a ticket and let us know your views to make the code better https://webkul.uvdesk.com/en/customer/create-ticket/

Kindly visit the WooCommerce plugins page to explore a wide variety of solutions to add more features to your online store get a Custom WordPress Theme Development Service. Also, you can hire WooCommerce developers for your project work.

!!Have a Great Day Ahead!!

Thanks for Your Time! Have a Good Day!

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home

WordPress Add Custom Links Plugin Page