0

With a form I am saving the data to WordPress options, it's a big multidimensional array. The problem that I am facing is sometimes it misses a value in the array. I am not sure how to debug that as it works 80% of time. Can this be related as I am saving it as an array?

2
  • 1
    You're not just randomly losing values in an array just because you're saving an array. You're losing data because there's a mistake in your code. It doesn't matter what format you choose to save in if your code has an error. This is not an inherent problem with arrays. Nov 25, 2019 at 11:34
  • @JacobPeattie Yeah it was an error in the code.
    – user145078
    Nov 25, 2019 at 11:56

1 Answer 1

0

It depends, if you use the data, only as a whole. Lets say for configuration settings or something, then I would say, it's not a problem. But if you are doing queries on the data, like searching or fetching only 1 or 2 fields from that array.. you should use other solutions.

If you are missing some values from your array, are you sure these values are submitted from your form? (Are the fields not "disabled", or are these fields unchecked checkboxes?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.