Only in WORDPRESS: REST.php ---> Unable to decode supplied JSON
This is my first post for CiviCRM.
Hi to all.
I have seen others post related and nowadays the problem remain.
Different from this post: https://civicrm.stackexchange.com/questions/6585/rest-api-unable-to-decode-supplied-json
- with wordpress I got always the same response "Unable to decode supplied JSON".
I tried clear installation with Joomla and also Backdrop, and both works correctly.
I am not a good programmer but I tried to do some stuff myself, here you what I prepared on my little server:
WordPress+CiviCRM with the problem: link clear installation
WordPress+CiviCRM fixed myself: custom
Here you what I modified to the file REST.php...
after line 326
if (array_key_exists('json', $requestParams) && $requestParams['json'][0] == "{") {
$params = json_decode($requestParams['json'], TRUE);
my modification start here
$new_requestParams = $requestParams['json'];
$new_requestParams = str_replace("\\", "", $new_requestParams);
$new_requestParams = str_replace("\\", "", $new_requestParams);
$params = json_decode($new_requestParams, TRUE);
I practically saw a lot of "\" before the JSON DECODE.
So removing this "\" now works regularly.
If you wish can check directly on both sites: Clear ----> http://144.91.105.68/cms/wordpress
Custom ---> http://144.91.105.68/cms/cust/wordpress
The user and password are both same: admin / admin
And also siteKey and api_key are always: a42bfc2b33cf13184711bff14fe1fb19
Regards Roberto T.