如何将 meta_value 更新为 wp_postmeta
How to update meta_value to wp_postmeta
我正在制作我的插件。我想更新这个值
a:1:{i:0;s:22:{"include/archive/author";}
最多 wp_postmeta
个表格使用 update_post_meta()
方法。
但 İt 正在增加价值,同时增加了附加价值我的元价值
s:41:"a:1:{i:0;s:22:{"include/archive/author";}";
如何只添加我的值
a:1:{i:0;s:22:{"include/archive/author";}
谢谢。
问题是您正在序列化序列化字符串。
您的原始数组如下所示:
array(0=>'include/archive/author');
您可能正在做这样的事情:
update_post_meta($post_id,$meta_key,$author);
你打算这样做的地方:
update_post_meta($post_id,$meta_key,$author[0]);
我正在制作我的插件。我想更新这个值
a:1:{i:0;s:22:{"include/archive/author";}
最多 wp_postmeta
个表格使用 update_post_meta()
方法。
但 İt 正在增加价值,同时增加了附加价值我的元价值
s:41:"a:1:{i:0;s:22:{"include/archive/author";}";
如何只添加我的值
a:1:{i:0;s:22:{"include/archive/author";}
谢谢。
问题是您正在序列化序列化字符串。
您的原始数组如下所示:
array(0=>'include/archive/author');
您可能正在做这样的事情:
update_post_meta($post_id,$meta_key,$author);
你打算这样做的地方:
update_post_meta($post_id,$meta_key,$author[0]);