Wordpress Wp_查询中Wp_帖子的Where条件

Wordpress Wp_查询中Wp_帖子的Where条件,wordpress,Wordpress,我在wordpress中使用WP_查询获取记录时遇到问题。我有一个工作自定义查询,但我需要以WP_查询的形式进行此查询 Select * from wp_posts where post_type = 'awards' AND post_status = 'publish' AND ID < '$lastmsg' order by ID desc limit 4; 从wp_posts中选择*,其中post_type='awards',post_status='publish',ID“奖励

我在wordpress中使用WP_查询获取记录时遇到问题。我有一个工作自定义查询,但我需要以WP_查询的形式进行此查询

Select * from wp_posts where post_type = 'awards' AND post_status = 'publish' AND ID < '$lastmsg' order by ID desc limit 4;
从wp_posts中选择*,其中post_type='awards',post_status='publish',ID<'lastmsg'顺序按ID描述限制4;
我的WP_查询参数

$args = array(
   'post_type' => 'awards',
   'post_status' => 'publish',
   'posts_per_page' => 4,
   'meta_query' => array(
          array( 
              'key' => 'ID',
              'value' => $POST_ID,
              'compare' => '<'
          )
    )
);
$args=array(
“发布类型”=>“奖励”,
“发布状态”=>“发布”,
“每页帖子数”=>4,
“元查询”=>数组(
数组(
'key'=>'ID',
“值”=>$POST\U ID,

“比较”=>“这是解决您问题的替代方案。我希望它对您有用

<?php
$fivesdrafts = $wpdb->get_results( 
    "
    SELECT * 
    FROM $wpdb->posts
    WHERE post_status = 'draft' 
        AND post_author = 5
    "
);

if ( $fivesdrafts )
{
    foreach ( $fivesdrafts as $post )
    {
        setup_postdata( $post );
        ?>
        <h2>
            <a href="<?php the_permalink(); ?>" rel="bookmark" title="Permalink: <?php the_title(); ?>">
                <?php the_title(); ?>
            </a>
        </h2>
        <?php
    }   
}
else
{
    ?>
    <h2>Not Found</h2>
    <?php
}
?>

您能分享一下您的错误吗?在第一次查询中,您仅从wp_帖子中获取数据,但在第二次查询中,您使用meta_查询从两个表中获取数据。下面是一个示例,我希望它能对您有所帮助。谢谢您的回复。我知道我的第二次查询是错误的。我只想在WP_查询的形式类似于第二个查询,但我不知道如何实现WP_posts表的where条件。