From ebb98a9d61f359149245aa5c2b2af4ff06ec3a7a Mon Sep 17 00:00:00 2001 From: Rami Yushuvaev Date: Wed, 6 May 2026 09:32:01 +0300 Subject: [PATCH] Fix: improve performance by not loading REST controllers on frontend --- src/php/Plugin.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/php/Plugin.php b/src/php/Plugin.php index d25a399c..f4b4377e 100644 --- a/src/php/Plugin.php +++ b/src/php/Plugin.php @@ -127,11 +127,17 @@ public function load_plugin() { $this->admin = new Bootstrap_Admin(); } - new Snippets_REST_Controller(); - new Cloud_Snippets_REST_Controller( $this->cloud_api ); - new Recently_Active_REST_Controller(); - new Plugins_Import_REST_Controller(); - new File_Import_REST_Controller(); + add_action( + 'rest_api_init', + function () { + new Snippets_REST_Controller(); + new Cloud_Snippets_REST_Controller( $this->cloud_api ); + new Recently_Active_REST_Controller(); + new Plugins_Import_REST_Controller(); + new File_Import_REST_Controller(); + }, + 1 + ); new Shortcodes(); new MCE_Plugin();