admin管理员组文章数量:1415655
I am trying to get a meta query with a regular expression to work.
I have a custom post type with a custom field "participant-id".
The custom field stores a comma-delimited string of user IDs, like: 56,123,99,199
My query is:
'meta_query' => array(
array(
'key' => 'event-id',
'value' => $eventID,
'compare' => '=',
),
array(
'key' => 'participant-id',
'value' => "(?<!(\d|\w))99(?!(\d|\w))",
'compare' => "REGEXP",
)
)
According to the WP Codex and all other examples I have found here on the topic, this should work, but it doesn't. The right values are not returned, meaning that in this case, the post that has a custom field with a participant id of 99 in it is not found.
I am trying to get this regular expression to work because before I had a LIKE compare operator and it would consider 99 and 199 to be the same, giving false results.
Any suggestions?
Thanks.
本文标签: Meta query with regular expression does not work
版权声明:本文标题:Meta query with regular expression does not work 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745157657a2645271.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论