I have a custom post type with an address field. I am importing posts using a script, this is the code for importing address field:
update_post_meta($submission_id, 'wpcf-office-address', $office_address);
The address field gets imported, but it's not shown on the map correctly. If I enter the field in WP backend for the suggestions to show up and pick the first suggestion , the pin on the map gets moved on the right place. I then save the post, but when it gets loaded again, pin is on the wrong place again.
I have recorded a short video demonstrating the problem:
enlace oculto
Any idea what am I doing wrong?
Best regards,
Petar
Hi Petar,
First let's establish if you manually create a post in the custom post type and add the address it works ok?
And only it happens when you import the address using the code you shared?
If that is the case, please check the database of your website and where the address is stored in wp_options table.
I do not remember exactly, but it might be added with a specific format so when you add it via code you do not follow the same rule base.
The best way is to create one manually, and then check the database to know how it is stored.
That way you can modify your code to accommodate the same format.
Thanks.
Hi Christopher,
thanks for a reply. I did a bit more researching, this is obviously google maps issue, not toolset one.
When I manualy create a post and enter problematic address, I don't even get that address suggested. When I pick the first suggestion, leave the address field, and enter it again, I get the correct address suggested.
But then again, if I save a post and reload it, pin is not placed correctly.
It's a bit complicated to explain by words, let me show you in the video:
enlace oculto
I'm aware this is not a toolset issue, but do yo, by any chance, know why this is happening?
Hi there,
Thank you for the video, I am not sure why that is happening.
The thing that I suggest is to test with another browser without andy extensions. I see that you have an extension that shows in the input box for the browser you use, maybe it has something to do with the issue?
Other than that honestly I have no clue.
Hi Christopher,
I've tried with vanilla Edge, the same thing happens.
But OK, it's obviously an issue with Google Maps and this particular address, it's not Toolset to blame 🙂
Thank you for your assistance!
Petar