diff --git a/inc/CLI_Command.php b/inc/CLI_Command.php index dbb095f..d12ff3b 100644 --- a/inc/CLI_Command.php +++ b/inc/CLI_Command.php @@ -16,6 +16,8 @@ class CLI_Command extends WP_CLI_Command { * Success: The OPcache was successfully cleared! */ public function clear() { + wp_set_current_user( 0 ); + $response = wp_remote_post( add_query_arg( [ 'opcache_action' => 'clear-opcache', @@ -67,6 +69,8 @@ public function clear() { * Success: The OPcache was successfully invalidated for foo/bar.php. */ public function invalidate( array $args, array $assoc_args ) { + wp_set_current_user( 0 ); + $script = $args['0']; $response = wp_remote_post( add_query_arg( [ diff --git a/wp-cli-clear-opcache.php b/wp-cli-clear-opcache.php index 7708063..ed15055 100644 --- a/wp-cli-clear-opcache.php +++ b/wp-cli-clear-opcache.php @@ -3,7 +3,7 @@ * Plugin Name: WP-CLI Clear OPcache * Plugin URI: https://github.com/wearerequired/wp-cli-clear-opcache * Description: Use WP-CLI to clear the OPcache for a site via HTTP. - * Version: 1.0.1 + * Version: 1.0.2 * Author: required * Author URI: https://required.com * License: GPL v2.0+