From 5841b3a25e5e4914904465c3539b68f0b834f3a3 Mon Sep 17 00:00:00 2001 From: Miguel Santana Date: Thu, 14 Jul 2022 10:47:13 -0500 Subject: [PATCH] Initialize session manager after setup theme This is for compatibility with themes that use composer to load dependencies that this plugin requires, but the plugin is trying to initialize before the theme has a chance to register the autoloader --- wp-session-manager.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-session-manager.php b/wp-session-manager.php index 17d4b3c..ad91a6a 100644 --- a/wp-session-manager.php +++ b/wp-session-manager.php @@ -146,11 +146,11 @@ function wp_session_manager_start_session() } else { // Start up session management, if we're not in the CLI. if (session_status() !== PHP_SESSION_DISABLED && (!defined('WP_CLI') || false === WP_CLI)) { - add_action('plugins_loaded', 'wp_session_manager_initialize', 1, 0); + add_action('after_setup_theme', 'wp_session_manager_initialize', 1, 0); // If we're not in a cron, start the session if (!defined('DOING_CRON') || false === DOING_CRON) { - add_action('plugins_loaded', 'wp_session_manager_start_session', 10, 0); + add_action('after_setup_theme', 'wp_session_manager_start_session', 10, 0); } } }