Title: Help with correcting problems for a plugin
Last modified: May 5, 2024

---

# Help with correcting problems for a plugin

 *  Resolved [vanblaisa](https://wordpress.org/support/users/vanblaisa/)
 * (@vanblaisa)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/help-with-correcting-problems-for-a-plugin/)
 * I’ve been using GPT to help me write a plugin for a website I’m working on, I’ve
   had success with most of it but am now struggling when it comes to writing saving,
   storing and retrieving the information from the wordpress options table in the
   database. I’ve been going round in circles for about 2 weeks now and am way behind
   my deadline to get this done.
   Below is the existing code I have, any assistance
   to work out the problem is very much appreciated:[_excessive poorly formatted
   code redacted_]
    -  This topic was modified 2 years, 1 month ago by [bcworkz](https://wordpress.org/support/users/bcworkz/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/help-with-correcting-problems-for-a-plugin/#post-17733920)
 * [@vanblaisa](https://wordpress.org/support/users/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?
 *  Thread Starter [vanblaisa](https://wordpress.org/support/users/vanblaisa/)
 * (@vanblaisa)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/help-with-correcting-problems-for-a-plugin/#post-17733932)
 * 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](https://pastebin.com/atADsv9W)
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/help-with-correcting-problems-for-a-plugin/#post-17736904)
 * 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.
 *  Thread Starter [vanblaisa](https://wordpress.org/support/users/vanblaisa/)
 * (@vanblaisa)
 * [2 years, 1 month ago](https://wordpress.org/support/topic/help-with-correcting-problems-for-a-plugin/#post-17742763)
 * It turns out there was another plugin causing a conflict and it’s been resolved
   now, thanks for your assistance mate

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Help with correcting problems for a plugin’ is closed to new replies.

## Tags

 * [plugin-development](https://wordpress.org/support/topic-tag/plugin-development/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 4 replies
 * 2 participants
 * Last reply from: [vanblaisa](https://wordpress.org/support/users/vanblaisa/)
 * Last activity: [2 years, 1 month ago](https://wordpress.org/support/topic/help-with-correcting-problems-for-a-plugin/#post-17742763)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
