@vanblaisa — I’m sorry but the forum’s parser made a mess of your code, making it difficult to read and impossible for others to independently test. While it’s fine to post brief snippets here if within a code block, more extensive code should be added to pastebin.com or gist.github.com. Then just provide the resulting link here.
What sort of problem are you encountering anyway?
Hi bcworkz,
Thank you for the reply. I’m having trouble saving data from an API endpoint from Hostfully.
I can’t seem to save it to the table created within the wordpress options, nor retrieve it (should actually save).
I’ve taken your advice and added the code to https://pastebin.com/atADsv9W
I don’t know the protocols for that API, but I suspect it’s not responding in a way or structure that you’re expecting. I recommend var_dumping $response, $body, and $photos (in fetch_property_photos()) to ensure everything is as expected.
I’m not sure why ob_start() is used other than what the comment says about headers. I’m not seeing where headers are output to a client app so I’m not sure it’s necessary. Assuming it is anyway, I’d think the buffer ought to be cleared before redirecting elsewhere? As-is shouldn’t impact whatever trouble you’re having, other than you wouldn’t see the error outputs.
Beyond that, all I can suggest is basic debugging by checking every interim variable’s content to ensure all is as expected. Obviously something’s not right along the way somewhere and it’s just a matter of finding it. You could even debug into update_option() if you had to but it shouldn’t be necessary.
Have you confirmed if anything is saved in the options table via phpMyAdmin? There could be everything there and there’s an issue with output, not getting the API data. Presence or not outside of WP will indicate which direction you need to investigate further.
It turns out there was another plugin causing a conflict and it’s been resolved now, thanks for your assistance mate