Skip to content

Commit c83a296

Browse files
committed
Add a settings link to the plugins admin screen
1 parent 3e3d045 commit c83a296

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

includes/class-wp-php-console.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ public function __construct() {
7171

7272
// Load admin.
7373
if ( ! defined( 'DOING_AJAX' ) && is_admin() ) {
74+
75+
// Add a settings link to the plugins admin screen.
76+
$plugin_name = str_replace( 'includes/class-', '', plugin_basename( __FILE__ ) );
77+
add_filter( "plugin_action_links_{$plugin_name}", function( $actions ) {
78+
return array_merge( array(
79+
'<a href="' . esc_url( admin_url( 'options-general.php?page=wp-php-console' ) ) . '">' . __( 'Settings', 'wp-php-console' ) . '</a>',
80+
), $actions );
81+
} );
82+
7483
require_once __DIR__ . '/class-wp-php-console-settings.php';
7584
new Settings( $this->options );
7685
}
@@ -106,7 +115,7 @@ public function set_locale() {
106115
load_plugin_textdomain(
107116
'wp-php-console',
108117
false,
109-
dirname( plugin_basename( __FILE__ ) ) . '/languages/'
118+
dirname( dirname( plugin_basename( __FILE__ ) ) ) . '/languages/'
110119
);
111120

112121
}

0 commit comments

Comments
 (0)