Skip to content

Commit f36bebf

Browse files
committed
📦 NEW: Added 'settings' link to Plugins page
1 parent 057921b commit f36bebf

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

benchpress.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@
3434
define( 'BENCHPRESS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
3535
define( 'BENCHPRESS_VERSION', '1.0.2' );
3636

37+
// Create variable for settings link filter.
38+
$plugin_name = plugin_basename( __FILE__ );
39+
40+
/**
41+
* Add settings link on plugin page
42+
*
43+
* @param array $links an array of links related to the plugin.
44+
*
45+
* @since 1.1.0
46+
* @return array updatead array of links related to the plugin.
47+
*/
48+
function benchpress_settings_link( $links ) {
49+
// Settings link.
50+
$settings_link = '<a href="admin.php?page=benchpress">' . esc_html__( 'Settings', 'benchpress' ) . '</a>';
51+
// Add the settings link to the $links array.
52+
array_unshift( $links, $settings_link );
53+
54+
return $links;
55+
}
56+
add_filter( "plugin_action_links_$plugin_name", 'benchpress_settings_link' );
57+
3758
// Add the Plugin Update Checker.
3859
require 'vendor/plugin-update-checker/plugin-update-checker.php';
3960
use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

0 commit comments

Comments
 (0)