admin管理员组文章数量:1122832
I'm building the analytics script plugin which offers customizations on a settings page. There will be around 20 options in total.
Does it affect the performance negatively if I manage these 20 options separately? So each of them will have a database record instead of storing it all as one.
I remember that all options will get preloaded on every page in WordPress anyway unless explicitly specified not to when registering a setting.
I'm building the analytics script plugin which offers customizations on a settings page. There will be around 20 options in total.
Does it affect the performance negatively if I manage these 20 options separately? So each of them will have a database record instead of storing it all as one.
I remember that all options will get preloaded on every page in WordPress anyway unless explicitly specified not to when registering a setting.
Share Improve this question edited Apr 2, 2024 at 17:15 Ostap Brehin asked Apr 2, 2024 at 17:06 Ostap BrehinOstap Brehin 1517 bronze badges2 Answers
Reset to default 1If you are looking for performance and have 20 options so yes it is better to store in 1 option key in serialize()
manner.
It shouldn’t affect performance to store each option in a separate row. The PHP application is capable of fetching multiple rows in a single batch and, in fact, WordPress itself stores its settings one per row.
I recommend using the Options API so that WordPress does most of the work for you.
https://developer.wordpress.org/apis/options/
As suggested on the WordPress Forum by one of the team members.
本文标签: When to store store plugin options as a single database record
版权声明:本文标题:When to store store plugin options as a single database record? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736295803a1929649.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论