Add Dashboard link to plugin action links on plugins page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
20
wp-bnb.php
20
wp-bnb.php
@@ -189,3 +189,23 @@ function wp_bnb_deactivate(): void {
|
||||
}
|
||||
|
||||
register_deactivation_hook( __FILE__, 'wp_bnb_deactivate' );
|
||||
|
||||
/**
|
||||
* Add action links to the plugins page.
|
||||
*
|
||||
* @param array $links Existing plugin action links.
|
||||
* @return array Modified plugin action links.
|
||||
*/
|
||||
function wp_bnb_plugin_action_links( array $links ): array {
|
||||
$dashboard_link = sprintf(
|
||||
'<a href="%s">%s</a>',
|
||||
esc_url( admin_url( 'admin.php?page=wp-bnb' ) ),
|
||||
esc_html__( 'Dashboard', 'wp-bnb' )
|
||||
);
|
||||
|
||||
array_unshift( $links, $dashboard_link );
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
add_filter( 'plugin_action_links_' . WP_BNB_BASENAME, 'wp_bnb_plugin_action_links' );
|
||||
|
||||
Reference in New Issue
Block a user