WordPress wp_remote_request() – How to do async await in wordpress php?
I have experience with JS but I am new to php and wordpress.
I am trying to call an external API from my functions.php in wordpress, but the problem is : I have to call it once to get the token, than use this token in another call.
So the problem is pretty basic : When the second call fires, I still don’t have the token. Duh !
In JS it’s pretty basic : async await and it s done !
Is there such a thing in php/wordpress ?
I use wp_remote_request() to post and get back the token. Then I have to post again.
Thank you very much in advance !
02 months 2023-04-06T09:37:08-05:00 2023-04-06T09:37:08-05:00 0 Answers 0 views 0
Leave an answer