'Passing Data between Wordpress Loops in an Ajax environment
I have a Wordpress strategy question regarding getting data from one Loop to another.
Please forgive me if it's naive.
My scenario:
A website visitor (not logged in) enters data to an ajax enabled page
Ajax send field capture info back to server
Server performs some 3rd party (banking) API calls via CURL and receives a 3rd party URL
Server passes 3rd party URL to client via Ajax response
Client redirects to the 3rd party URL
3rd Party site completes with a call to a dedicated page on my site eg. https://mysite/banking-response
Server processes the response.
The problem I have faced is that I need to retain some data from the original Ajax call (2) in the final step (7) Clearly step (7) is in a different Loop.
I have an interim solution which saves the data in wp_options with a fixed option_name.
This works, however, I'm concerned that it is not thread-safe robust. If multiple visitors enter this process at the same time it could get messy. All users will attempt to save their data in a single DB row.
The visitor is not logged in, so I can't use usermeta.
Is there an accepted/correct way of doing this?
Thanks in advance, Jerry
I considered using a modified URL Query string and $_GET but due to the 3rd party redirect I have no control over the URL when it completes and passes execution back to my server.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
