2017-08-24 28 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將是巨大的

回答