Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.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
Php WordPress get_posts函数中的多个数组键_Php_Wordpress - Fatal编程技术网

Php WordPress get_posts函数中的多个数组键

Php WordPress get_posts函数中的多个数组键,php,wordpress,Php,Wordpress,小问题。我需要在wordpress函数中指定多个元键和值。谁能告诉我怎么做 <?php $args = array( 'posts_per_page' => 5, 'offset' => 0, 'category' => '', 'category_name' => '', 'orderby' => 'post_date', 'order'

小问题。我需要在wordpress函数中指定多个元键和值。谁能告诉我怎么做

<?php $args = array(
    'posts_per_page'   => 5,
    'offset'           => 0,
    'category'         => '',
    'category_name'    => '',
    'orderby'          => 'post_date',
    'order'            => 'DESC',
    'include'          => '',
    'exclude'          => '',
    'meta_key'         => '',
    'meta_value'       => '',
    'post_type'        => 'post',
    'post_mime_type'   => '',
    'post_parent'      => '',
    'post_status'      => 'publish',
    'suppress_filters' => true 
);
$posts_array = get_posts( $args ); ?>

好的,没关系,在文档中找到了我的解决方案。如果有人需要它

$args = array(
    'post_type' => 'product',
    'meta_query' => array(
        array(
            'key' => 'featured',
            'value' => 'yes',
        )
    )
 );
$postslist = get_posts( $args );