WC_Admin_Status::remove_log
Remove/delete the chosen file.
Method of the class: WC_Admin_Status{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = WC_Admin_Status::remove_log();
WC_Admin_Status::remove_log() WC Admin Status::remove log code WC 11.2.1
public static function remove_log() {
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( wp_unslash( $_REQUEST['_wpnonce'] ), 'remove_log' ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Tools are allowlisted and nonce-protected; log handles are sanitized and confined.
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
}
if ( ! empty( $_REQUEST['handle'] ) ) {
$log_handler = new WC_Log_Handler_File();
$log_handler->remove( wp_unslash( $_REQUEST['handle'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- Tools are allowlisted and nonce-protected; log handles are sanitized and confined.
}
wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) );
exit();
}