admin管理员组文章数量:1394054
I have an array of values to store in the post meta, my post data looks like below JSON representation
[
{
"field_1": "value 1",
},
{
"field_1": "value 2",
},
{
"field_1": "value 3",
},
]
And each item can have multiple keys like field_2, field_3 other than field_1, i have converted the JSON to array, and looped through each item and store in meta data by calling add_post_meta() function, but the problem arises when i want to have a duplicate in this list like this
[
{
"field_1": "value 1",
},
{
"field_1": "value 1",
},
]
since i need the ability to update each item, i need to find a way to make the meta to properly update duplicate values, because update_post_meta take previous value and current value so if i update field_1 to any value, the second item might be updated to same value of first item, how to handle this problem?
本文标签: Can we have duplicate key pair values in post meta data
版权声明:本文标题:Can we have duplicate key pair values in post meta data? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744775607a2624603.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论