Skip to content

Commit

Permalink
Do not parse shortcodes in REST context for PUT, POST and DELETE methods
Browse files Browse the repository at this point in the history
update dates
  • Loading branch information
bastienho committed Jun 12, 2018
1 parent b935b5f commit 46d7f7d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions includes/civicrm.shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,17 @@ public function prerender( $wp ) {
* @return string HTML for output
*/
public function render_single( $atts ) {
// Do not parse shortcodes in REST context, which breaks saving in Gutenberg editor
if(defined('REST_REQUEST') && REST_REQUEST){
return;
// 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) ) {
Expand Down

0 comments on commit 46d7f7d

Please sign in to comment.