Request Quote

WordPress Add Custom Plugin Action Links

WordPress Add Custom Plugin Action Links – In this post we see how we can add custom action links to plugin on plugin page. When we create plugin to perform some actions , then sometimes we need to add more links to plugin actions for any task.

Let’s start with creating one test plugin –

<?php

/*
 * Plugin Name: Plugin Custom Action
 * Description: Add custom action to plugin actions on plugin along with activate/deactivate, edit.
 * Author: Webkul
 * Author URI: https://webkul.com
 * Version: 1.0
*/

?>

The plugin will list in plugin page as seen below –

We will add our custom link e.g. Demo with Deactivate and Edit shown in above image –

<?php

/*
 * Plugin Name: Plugin Custom Action
 * Description: Add custom action to plugin actions on plugin along with activate/deactivate, edit.
 * Author: Webkul
 * Author URI: https://webkul.com
 * Version: 1.0
 * Text Domain: domain
*/

add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'wk_plugin_settings_link' );

function wk_plugin_settings_link( $links )
{
    $url = 'https://wordpressdemo.webkul.com';

    $_link = '<a href="'.$url.'" target="_blank">' . __( 'Demo', 'domain' ) . '</a>';

    $links[] = $_link;

    return $links;
}

Using above code we added the custom link named Demo to plugin action links. We provide here some site url for example, which looks on plugin page as below –

In above image we can see that the demo link is displaying with default links. So, in this way we can add custom plugin action links to plugin on 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/

Thanks for Your Time! Have a Good Day!

. . .

Comment

Add Your Comment

Be the first to comment.

css.php
Hire Us!
Brief us about your requirements and we'll get back to you.
Woo! Hooy!
We have just recieved your project brief and our expert will contact you shortly.
Send Again
Close

Index