From e34511b0562a95de1c6a1cbc4aedb6cfd0c3eb78 Mon Sep 17 00:00:00 2001 From: Dernerd Date: Fri, 7 Jun 2024 00:49:35 +0200 Subject: [PATCH] session_start wird nur noch einmal geladen --- includes/admin/class-mp-ajax.php | 2 ++ includes/public/class-mp-public.php | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/admin/class-mp-ajax.php b/includes/admin/class-mp-ajax.php index c54e220..1650c54 100644 --- a/includes/admin/class-mp-ajax.php +++ b/includes/admin/class-mp-ajax.php @@ -520,6 +520,8 @@ public function lookup_order() { * @action wp_ajax_nopriv_mp_update_product_list, wp_ajax_mp_update_product_list */ public function update_product_list() { + // Start session if not already started + $this->session_start(); $page = mp_get_post_value( 'page', 1 ); $per_page = mp_get_post_value( 'per_page', 1 ); $category = mp_get_post_value( 'product_category' ); diff --git a/includes/public/class-mp-public.php b/includes/public/class-mp-public.php index 9e8cccf..2c3365c 100644 --- a/includes/public/class-mp-public.php +++ b/includes/public/class-mp-public.php @@ -45,10 +45,6 @@ public static function get_instance() { * @access private */ private function __construct() { - // Start a session only if it's not already started - if (session_id() === '') { - session_start(); - } //$this->includes(); add_action( 'wp', array( $this, 'disable_caching' ) ); @@ -595,7 +591,9 @@ function maybe_serve_download() { */ public function maybe_session_start() { if ( mp_is_shop_page( 'checkout' ) || mp_is_shop_page( 'cart' ) ) { - $this->session_start(); + if ( session_id() === '' ) { + session_start(); + } } }