Skip to content

Commit

Permalink
Improves the adding Settings link to plugins page.
Browse files Browse the repository at this point in the history
  • Loading branch information
pandammonium committed Feb 23, 2023
1 parent d17dbbf commit ab87870
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions blipper-widget.php
Expand Up @@ -71,14 +71,16 @@ function register_blipper_widget() {
*
* @since 0.0.1
*/
function blipper_widget_add_settings_link( $links ) {
$links[] = '<a href="' .
esc_url( admin_url( 'options-general.php?page=blipper-widget' ) ) .
'">' . __('Settings', 'blipper-widget') . '</a>';
function blipper_widget_add_settings_link( $links, $file ) {

if ( strpos( $file, 'blipper-widget.php' ) !== false ) {

$links = array_merge( $links, array( '<a href="' . esc_url( admin_url( 'options-general.php?page=blipper-widget' ) ) . '">' . __('Settings', 'blipper-widget') . '</a>' ) );

}
return $links;
}
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'blipper_widget_add_settings_link' );
add_filter( 'plugin_action_links', 'blipper_widget_add_settings_link', 10, 2 );
}

if (!function_exists('blipper_widget_exception')) {
Expand Down

0 comments on commit ab87870

Please sign in to comment.