Skip to content

Commit

Permalink
Add link to cache settings on plugins page
Browse files Browse the repository at this point in the history
  • Loading branch information
xemlock committed Mar 3, 2021
1 parent 173f1bd commit feb0ea6
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions inc/wpeac-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ function __construct() {
add_action( 'after_switch_theme', array( $this, 'update_global_last_modified' ) );
// Set the new last modified global variable to prevent things from stale menus on pages that haven't been changed
add_action( 'edited_nav_menu', array( $this, 'update_global_last_modified' ) );
// Add link to cache settings on plugins page
add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 3 );
}
/**
* Register Admin Menu
Expand Down Expand Up @@ -569,4 +571,19 @@ function set_path() {
$url = array( $this->path_to_purge );
return $url;
}

function add_settings_link( $links, $plugin_file, $plugin_data ) {
static $this_plugin;

if ( ! $this_plugin ) {
$this_plugin = plugin_basename( realpath( dirname( __FILE__ ) . '/../wpe-advanced-cache.php' ) );
}

if ( $plugin_file === $this_plugin ) {
$settings_link = '<a href="' . get_admin_url( null, 'options-general.php?page=cache-settings' ) . '">' . esc_html(__('Settings')) . '</a>';
array_unshift( $links, $settings_link );
}

return $links;
}
}

0 comments on commit feb0ea6

Please sign in to comment.