acf-city-selector
acf-city-selector copied to clipboard
City won't selected if its string contain apex
@Beee4life I found an issue on your lastest 1.3.1 version of plugin.
If the City name contain apex (or apostrophe), it won't "saved" properly. For example:
"City name" is saved properly. "City's name" won't saved. Debugging a bit: in database the value of City appear stored as serialized array without any escape char before the apex.
I opened the "acfcs-functions.php" and edit the lines 536, 543 and 550 with:
$selected_value = esc_attr($stored_value);
Now the City with apex will appear properly as selected on the dropdown.
That's strange, before appling the above code, by echoing $key and $selected_value, they appears as equal strings, but at line 572 the ternary condition doesn't work as expected.
I'm no pretty sure about this method could be the best, maybe you need to check or escape the chars before store values. I have not much time to investigate better, but take a look and check yourself.
Ok, thanks, will try to look into it this weekend...
Fixed in this commit.
I see you hearted the previous reply but did it all work for you ?