Every time my user save's their location in a CRED form, apostrophes get double escaped.
I have a location field. I expect to see: 68 O'Connell Street
Instead, I see: 68 O\\\\'Connell Street
More and more backslashes get added every time there is an edit.
The forums talk about similar problems in the CSS and JS sections, but those were apparently resolved 4 years ago?
Hello,
I can duplicate the same problem, will escalate this issue.
Currently, please try to remove the extra Backslashes with cred_save_data actions, see below test site:
Login URL: hidden link
1) Dashboard-> Toolset-> Settings-> Custom codes:
hidden link
Add one item, with below codes:
add_action('cred_save_data', function($post_id, $form_data){
if($form_data['id'] == 23){
$location = get_post_meta($post_id, 'wpcf-location', true);
update_post_meta($post_id, 'wpcf-location', stripcslashes($location));
}
}, 99, 2);
Please replace 23 with your post form ID, replace "location" with your custom address field slug
2) Test it in frontend:
hidden link
It works fine.
More helps:
hidden link
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
Thanks so much - that fixed my issue.