From 8ae771f3760733c1ac3cafcfb0c2e2fd7476ddfa Mon Sep 17 00:00:00 2001 From: Christian Wach Date: Tue, 25 Sep 2018 14:06:01 +0100 Subject: [PATCH] Do not start session when running under WP-CLI --- civicrm.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/civicrm.php b/civicrm.php index a433e3f..241fd5f 100644 --- a/civicrm.php +++ b/civicrm.php @@ -301,7 +301,8 @@ class CiviCRM_For_WordPress { $this->civicrm_in_wordpress_set(); // there is no session handling in WP hence we start it for CiviCRM pages - if (!session_id()) { + // except when running via WP-CLI which does not require sessions + if ( empty( session_id() ) && ! ( defined( 'WP_CLI' ) && WP_CLI ) ) { session_start(); } -- GitLab