From baed88e50d6b492c67a05ba4d85d5d1951fdd006 Mon Sep 17 00:00:00 2001 From: Andrei Mondoc <andreimondoc@gmail.com> Date: Tue, 4 Feb 2020 14:07:49 +0000 Subject: [PATCH] prevent clash with CiviCRM WP REST plugin Signed-off-by: Kevin Cristiano <kcristiano@kcristiano.com> --- civicrm.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/civicrm.php b/civicrm.php index cc72ce2df6..bcbcb094df 100644 --- a/civicrm.php +++ b/civicrm.php @@ -523,8 +523,10 @@ class CiviCRM_For_WordPress { include_once CIVICRM_PLUGIN_DIR . 'includes/civicrm.basepage.php'; $this->basepage = new CiviCRM_For_WordPress_Basepage; - // Include REST API autoloader class - require_once( CIVICRM_PLUGIN_DIR . 'wp-rest/Autoloader.php' ); + if ( ! class_exists( 'CiviCRM_WP_REST\Autoloader' ) ) { + // Include REST API autoloader class + require_once( CIVICRM_PLUGIN_DIR . 'wp-rest/Autoloader.php' ); + } } @@ -650,11 +652,15 @@ class CiviCRM_For_WordPress { // Register hooks for clean URLs. $this->register_hooks_clean_urls(); - // Set up REST API. - CiviCRM_WP_REST\Autoloader::add_source( $source_path = trailingslashit( CIVICRM_PLUGIN_DIR . 'wp-rest' ) ); + if ( ! class_exists( 'CiviCRM_WP_REST\Plugin' ) ) { + + // Set up REST API. + CiviCRM_WP_REST\Autoloader::add_source( $source_path = trailingslashit( CIVICRM_PLUGIN_DIR . 'wp-rest' ) ); - // Init REST API. - new CiviCRM_WP_REST\Plugin; + // Init REST API. + new CiviCRM_WP_REST\Plugin; + + } } -- GitLab