admin管理员组文章数量:1406918
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?
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?
Share Improve this question edited Nov 25, 2019 at 12:41 butlerblog 5,1213 gold badges28 silver badges44 bronze badges asked Nov 25, 2019 at 7:49 user145078user145078 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. – Jacob Peattie Commented Nov 25, 2019 at 11:34
- @JacobPeattie Yeah it was an error in the code. – user145078 Commented Nov 25, 2019 at 11:56
1 Answer
Reset to default 0It 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?)
本文标签: Is saving data to WordPress options as array bad thing to do
版权声明:本文标题:Is saving data to WordPress options as array bad thing to do? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744971793a2635278.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论