From 68a37b0a67aad57331a837921f7dcb822f4de81d Mon Sep 17 00:00:00 2001 From: Nikita Date: Sat, 6 Apr 2024 16:08:43 +0300 Subject: [PATCH] disable options autoload to prevent slowing down page loading when there are a lot of logs stored --- classes/class-logs.php | 2 +- classes/class-rest.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/class-logs.php b/classes/class-logs.php index 9b37a89..0e255c2 100644 --- a/classes/class-logs.php +++ b/classes/class-logs.php @@ -59,7 +59,7 @@ public function store_log( $data ) { array_unshift( $logs, $new_log ); - update_option( 'redirect_txt_logs', $logs ); + update_option( 'redirect_txt_logs', $logs, false ); } /** diff --git a/classes/class-rest.php b/classes/class-rest.php index 7dee81f..0580ed5 100644 --- a/classes/class-rest.php +++ b/classes/class-rest.php @@ -87,7 +87,7 @@ public function update_rules( WP_REST_Request $req ) { $new_rules = $req->get_param( 'rules' ); if ( isset( $new_rules ) ) { - update_option( 'redirect_txt_rules', sanitize_textarea_field( $new_rules ) ); + update_option( 'redirect_txt_rules', sanitize_textarea_field( $new_rules ), false ); } return $this->success( true ); @@ -118,7 +118,7 @@ public function update_settings( WP_REST_Request $req ) { if ( is_array( $new_settings ) ) { $current_settings = get_option( 'redirect_txt_settings', [] ); - update_option( 'redirect_txt_settings', array_merge( $current_settings, $new_settings ) ); + update_option( 'redirect_txt_settings', array_merge( $current_settings, $new_settings ), false ); } return $this->success( true );