Snippet: Additional Links in Plugin Dashboard

Following snippet is specifically for WordPress Plugin developers. It lets the developer add additional links below their plugin descriptions and beside the “Activate” or “Deactivate” links. This is very handy to provide quick links related to your plugin or author.

plugin links

Snippet

add_filter('plugin_row_meta',  'wpds_plugin_links', 10, 2);
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'wpds_plugin_link_actions' );
function wpds_plugin_links($links, $file) {
               $base = plugin_basename(__FILE__);
               if ($file == $base) {
                       $links[] = '<a href="admin.php?page=plugin_settings">' . __('Settings') . '</a>';
                       $links[] = '<a href="http://pluginwebsite.com/docs/">' . __('Documentation') . '</a>';
                       $links[] = '<a href="http://pluginwebsite.com/report-bug">' . __('Report Bug') . '</a>';
               }
               return $links;
}

function wpds_plugin_link_actions( $links ) {
	return array_merge(array('settings' => '<a href="admin.php?page=plugin_settings">' . __( 'Settings', 'domain' ) . '</a>'), $links);
}

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>