REST API calls using json param do not work in Wordpress context --backslashes are added
There is a long discussion on this on this PR but the approach still appears to be unresolved. I have closed the PR to track through gitlab https://github.com/civicrm/civicrm-core/pull/12813
When CiviCRM receives an API request through
extern/rest.php with a
json parameter, and the CMS is WordPress, an error will result.
This is because Civi bootstraps WordPress to authenticate the API user, and WordPress escapes all quotation marks in
$_POST variables whether or not PHP's
magic_quotes_gpc is enabled. CiviCRM is not expecting an escaped string, and JSON decoding fails due to the extra backslashes. See
wp_magic_quotes() which is called by
wp-settings.php during bootstrap.