title: WordPress pagination repeating first page
body: <p>This use to work, until wordpress updated and now the pagination on a custom page is repeating the first page. Page 2 for example will just show up page 1 content. </p>
  
  <p>I've been looking and looking and nothing is helping. </p>
  
  <p>I'm calling wordpress functions outside of wordpress install with</p>
  
  <pre><code>require($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');
  </code></pre>
  
  <p>then the wordpress loop is (and it's probably outdated and faulty, but this was the only one that worked at the time)</p>
  
  <pre><code>    $paged = ( get_query_var( 'page' ) ) ? absint( get_query_var( 'page' ) ) : 1;
         $args = array(
  'post_type' =&gt; 'product',
  'post_status' =&gt; 'publish',
  'posts_per_page' =&gt; 20,
             //'showposts' =&gt; 20,
  'orderby'=&gt; 'menu_order',
      'paged' =&gt; $paged,
       'meta_query' =&gt; array(
          array(
              'key' =&gt; '_stock_status',
              'value' =&gt; 'instock',
              'compare' =&gt; '=',
          )
      )      
  
  );
  
  query_posts( $args); ?&gt;
  
    &lt;?php
     $path = $_SERVER['DOCUMENT_ROOT'];
     $path .= "/includes/producttemplate.php";
     include_once($path);
  ?&gt;
  
  &lt;/div&gt;
  &lt;br class="clear" /&gt;
  &lt;div class="wrapper"&gt;
  &lt;div class="pagination"&gt;
  &lt;p&gt;&lt;br /&gt;&lt;?php pagination_bar($args); if(!$_GET['viewall']){ ?&gt;
  
  &lt;br /&gt;
  &lt;a class="all" href="&lt;?php  echo add_query_arg( array( 'view' =&gt; 'all' ), get_pagenum_link(1) ); ?&gt;"&gt;Show All&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;
  &lt;?php } }?&gt;
  &lt;?php wp_reset_query(); ?&gt;
  </code></pre>
  
  <p>and then my custom pagination function is</p>
  
  <pre><code>//Pagenation
  function pagination_bar() {
      global $wp_query;
  
      $total_pages = $wp_query-&gt;max_num_pages;
  
      if ($total_pages &gt; 1){
          $current_page = max(1, get_query_var('paged'));
   $paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
          echo paginate_links(array(
              'base' =&gt; @add_query_arg('paged','%#%'),
              'format' =&gt; '?paged=%#%',
              'current' =&gt; $paged,
              'total' =&gt; $total_pages,
          ));
      }
  }
  </code></pre>
  
  <p>Thank you</p>