我使用此代码显示自定义帖子:
$args = array(
\'category__in\' => $bookcat,
\'meta_query\' => array(
\'relation\' => \'OR\',
array(\'key\' => \'bookname\',\'compare\' => \'LIKE\',\'value\' => $bookname),
array(\'key\' => \'authr\',\'compare\' => \'LIKE\',\'value\' => $authr),
array(\'key\' => \'translator\',\'compare\' => \'LIKE\',\'value\' => $translator),
array(\'key\' => \'publisher\',\'compare\' => \'LIKE\',\'value\' => $publisher),
array(\'key\' => \'pyear\',\'compare\' => \'=\',\'value\' => $pyear,\'type\' => \'NUMERIC\'),
array(\'key\' => \'ptime\',\'compare\' => \'=\',\'value\' => $ptime,\'type\' => \'NUMERIC\')
)
);
meta\\u查询中有6个数组,当我使用该代码时,mysql服务器使用了超过80%的cpu!但当我使用4个或更少的数组时,效果很好。例如:
\'meta_query\' => array(
\'relation\' => \'OR\',
array(\'key\' => \'bookname\',\'compare\' => \'LIKE\',\'value\' => $bookname),
array(\'key\' => \'authr\',\'compare\' => \'LIKE\',\'value\' => $authr),
array(\'key\' => \'translator\',\'compare\' => \'LIKE\',\'value\' => $translator),
array(\'key\' => \'publisher\',\'compare\' => \'LIKE\',\'value\' => $publisher)
)
wordpress meta\\u查询中使用数组的数量是否有限制?还是我的密码有误?谢谢你的帮助。