From 09d990aee17a78357d79184682bc9cc10fe2d22a Mon Sep 17 00:00:00 2001 From: Kevin Cristiano <kcristiano@tadpole.cc> Date: Tue, 15 May 2018 19:22:20 -0400 Subject: [PATCH] pre-release Gutenberg shortcode block fixes Fixes https://lab.civicrm.org/dev/wordpress/issues/1 Plan for 5.2.0 release if not merged Signed-off-by: Kevin Cristiano <kcristiano@tadpole.cc> --- includes/civicrm.shortcodes.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/civicrm.shortcodes.php b/includes/civicrm.shortcodes.php index cf3068d5ff..a976567174 100644 --- a/includes/civicrm.shortcodes.php +++ b/includes/civicrm.shortcodes.php @@ -247,6 +247,18 @@ class CiviCRM_For_WordPress_Shortcodes { */ public function render_single( $atts ) { + // Do not parse shortcodes in REST context for PUT, POST and DELETE methods + if ( defined( 'REST_REQUEST' ) && REST_REQUEST && ( isset( $_PUT ) || isset( $_POST ) || isset( $_DELETE ) ) ) { + // Return the original shortcode + $shortcode = '[civicrm'; + foreach ( $atts as $att => $val ) { + $shortcode .= ' ' . $att . '="' . $val . '"'; + } + $shortcode .= ']'; + + return $shortcode; + } + // check if we've already parsed this shortcode global $post; if ( is_object($post) ) { -- GitLab