$results = new WP_Query( array(
\'post_type\' => \'questions\',
\'post_status\' => \'publish\',
\'no_found_rows\' => \'1\',
\'nopaging\' => \'1\',
\'ignore_sticky_posts\' => \'1\',
\'orderby\' => \'rand\',
\'meta_query\' => array(
\'relation\' => \'OR\',
array(
\'key\' => \'reference-1\',
\'value\' => \'lucht\',
\'compare\' => \'=\'
),
array(
\'key\' => \'reference-2\',
\'value\' => \'lucht\',
\'compare\' => \'=\'
)
)
));
echo $results->request;
给出:选择wp\\U帖子。*从wp\\u posts内部加入wp\\u postmeta ON(wp\\u posts.ID=wp\\u postmeta.post\\u ID),其中1=1和(wp\\u postmeta.meta\\u key=\'response\'和wp\\u postmeta.meta\\u value=\'lucht\')或(wp\\u postmeta.meta\\u key=\'answers\'和wp\\u postmeta.meta\\u value=\'lucht\')和wp\\u posts。post\\u类型=“问题”和((wp\\u posts.post\\u status=“发布”))按wp\\u posts分组。ID按兰德排序()
现在替换meta\\u query compare=to LIKE:
...
\'meta_query\' => array(
\'relation\' => \'OR\',
array(
\'key\' => \'reference-1\',
\'value\' => \'lucht\',
\'compare\' => \'LIKE\'
),
array(
\'key\' => \'reference-2\',
\'value\' => \'lucht\',
\'compare\' => \'LIKE\'
)
)
...
给出:选择wp\\U帖子。*从wp\\u posts内部连接wp\\u postmeta ON(wp\\u posts.ID=wp\\u postmeta.post\\u ID),其中1=1和((wp\\u postmeta.meta\\u key=\'response\'和wp\\u postmeta.meta\\u值,如{c3232364fb7d50ba632c808436b28560295aade9067a1ec4ae1f4c5879c13d}lucht{c3232364fb7d50ba632c808436b28560295aade9067a1fc4ae1f4c5879c13d})或(wp\\u postmeta.meta)eta.meta\\u键=\'answers\'和wp\\u postmeta.meta\\u值LIKE\'{c33232364fb7d50ba632c808436b28560295aade9067a11e1fc4ae1c5879c13d}lucht{c33232364fb7d50ba632c808436b28560295aade9067a11e1fc4ae1c5879c13d})和wp\\U职位。post\\u类型=“问题”和((wp\\u posts.post\\u status=“发布”))按wp\\u posts分组。ID按兰德排序()
{c33232364fb7d50ba632c808436b28560295aade9067a11e1fc4ae1c5879c13d}似乎是花括号中的某个随机值64字节值。如果改为%的话,查询就可以正常工作了。
我已经在不同服务器(4.9.5)上的两次安装中对此进行了测试,并关闭了所有插件。
问题是:我在这里做错了什么,还是应该创建一个bug罚单?