我有2个WP\\u查询,我想将它们合并为1个查询。以下是我最初的两个查询:
$childlist = new WP_Query( array (
\'numberposts\' => -1,
\'post_type\' => \'page\',
\'post_parent\' => $post->ID,
\'fields\' => \'ids\'
));
$childlist2 = new WP_Query( array (
\'numberposts\' => -1,
\'post_type\' => \'page\',
\'meta_key\' => \'extra_menu\',
\'meta_value\' => $post->ID,
\'meta_compare\' => \'LIKE\',
\'fields\' => \'ids\'
));
我试着用几种不同的方法将它们结合起来,但似乎找不到有效的解决方案。一旦我尝试这个或关系,它只会给出;或";。$childlist = new WP_Query(array(
\'numberposts\' => -1,
\'post_type\' => \'page\',
\'meta_query\' => array(
\'relation\' => \'OR\',
array(
\'key\' => \'post_parent\',
\'value\' => $post->ID,
\'compare\' => \'=\',
),
array(
\'key\' => \'extra_menu\',
\'value\' => $post->ID,
\'compare\' => \'LIKE\',
),
),
));
我该怎么解决这个问题呢?