Skip to content

Commit

Permalink
Update clear-caches.php
Browse files Browse the repository at this point in the history
  • Loading branch information
jessuppi authored Sep 7, 2024
1 parent 16a2952 commit 79d9181
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions clear-caches.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: Clear Caches
Plugin URI: https://www.littlebizzy.com/plugins/clear-caches
Description: Purge all of the WordPress caches
Version: 2.0.0
Version: 2.0.1
Author: LittleBizzy
Author URI: https://www.littlebizzy.com
License: GPLv3
Expand Down Expand Up @@ -90,8 +90,8 @@
}
}, 100 );

// Enqueue JavaScript for admin bar
add_action( 'wp_enqueue_scripts', function() {
// Enqueue JavaScript for both frontend and backend
function enqueue_clear_caches_scripts() {
if ( is_admin_bar_showing() ) {
wp_enqueue_script( 'clear-caches-script', plugin_dir_url( __FILE__ ) . 'clear-caches.js', [ 'jquery' ], null, true );

Expand All @@ -101,7 +101,9 @@
'nonce' => wp_create_nonce( 'clear_caches_nonce' )
] );
}
});
}
add_action( 'wp_enqueue_scripts', 'enqueue_clear_caches_scripts' ); // Frontend
add_action( 'admin_enqueue_scripts', 'enqueue_clear_caches_scripts' ); // Backend

// Handle AJAX requests
add_action( 'wp_ajax_clear_caches_action', function() {
Expand Down

0 comments on commit 79d9181

Please sign in to comment.