admin管理员组文章数量:1301541
So, we used to have this user meta field that stored a single ID to a post. I'm working on rewriting it so it can have multiple IDs to posts. So a single user can have multiple posts in that field. This all works, shows and stores correctly.
I had:
$meta_query = array(
array(
'key' => 'meta_field',
'value' => $value,
'compare' => '='
),
);
Which worked. How do I now search for example post ID '25688' in a meta field that is
"a:2:{i:0;s:5:"25688";i:1;s:5:"26974";}"
in DB.
I guess I could do a LIKE, but that seems prone to errors once you tick up a digit. Also won't allow me to search for multiple values at once like an IN would allow me to do.
This doesn't seem to be complicated, but has me stumped.
本文标签: Search for value(s) in meta field for a multi select
版权声明:本文标题:Search for value(s) in meta field for a multi select 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741677239a2391955.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论