Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wordpress WP_使用元键查询多个值?_Wordpress - Fatal编程技术网

Wordpress WP_使用元键查询多个值?

Wordpress WP_使用元键查询多个值?,wordpress,Wordpress,在获取多个值和单个元键的结果时,我确实面临着很多问题。 例子: 我有10个“鸡蛋”字的帖子。 我有5个“黄油”字的帖子 现在我使用下面的查询获取结果。它假设在结果中显示15个post,但不显示全部结果 $args = array( 'numberposts' => -1, 'post_type' => 'recipes', 'meta_query' => array( 'relation' => 'OR', array(

在获取多个值和单个元键的结果时,我确实面临着很多问题。 例子: 我有10个“鸡蛋”字的帖子。 我有5个“黄油”字的帖子

现在我使用下面的查询获取结果。它假设在结果中显示15个post,但不显示全部结果

$args = array(
'numberposts'   => -1,
'post_type'     => 'recipes',
'meta_query'    => array(
    'relation' => 'OR',
    array(
        'key'       => 'ingredients_repeat_%_name',
        'compare'   => 'LIKE',
        'value'     => 'Butter',
    ),
    array(
        'key'       => 'ingredients_repeat_%_name',
        'compare'   => 'LIKE',
        'value'     => 'Egg',
    ),
)

))

不要使用
numberposts
而是尝试
posts\u per\u page
。你可以了解更多关于

我不知道我怎么会这么愚蠢。结果很好。只有每页的post_未显示完整结果。谢谢