2017-08-24 59 views
0

我们试图从WordPress帖子中获取数据,其中一行没有问题,但我们希望在查询中使用where子句。我们希望获取ID大于100的所有行。我们尝试过比较,但后来我们知道meta_query是比较的。我们不想使用meta_query列,因为该列中没有数据。 我们试图增加偏移,我是希望它会成功,但它没有工作wordpress抓取大于id的数据100

$paginate_by = '1000'; 
    $offset = 0; 
    $has_more_images = true; 

    while ($has_more_images) { 
     $args = array(
      'p'    => $comp_last_id, // is 100 
      'posts_per_page' => $paginate_by, 
      'offset'   => 0, 
      'post_type'  => 'attachment', 
      'post_status' => 'any', 
      'orderby'  =>'ID', 
      'order'   => 'ASC' 

     ); 


     $the_query = new WP_Query($args); 
     if ($the_query -> have_posts()) { 
      while ($the_query -> have_posts()) { 
       $the_query -> the_post(); 
       $idall = get_the_ID(); 
      } 
     } 
     $args['offset'] += $paginate_by;   
      } 

在如何获取其ID的所有行的帮助大于100将是巨大的

回答