title: Wordpress paginate_links() not working
body: <p>Using Wordpress 4.0.1</p>
  
  <p>I have  query set up to echo out archive posts to a page.  Which works fine, here is the query.</p>
  
  <pre><code>$paged = ( get_query_var( 'paged' ) ) ? absint( get_query_var( 'paged' ) ) : 1;
  
  $args = array(
      'post_type' =&gt; 'post',
      'category__in' =&gt; array($category[0]-&gt;cat_ID), // gets the category ID higher up in the code.
      'posts_per_page' =&gt; 5,
      'paged' =&gt; $paged
  );
  
  if ($category[0]-&gt;cat_ID == 3) {
  
      $today = date('Ymd');                       
      if (!empty($year) &amp;&amp; !empty($monthnum)) {
          $args['meta_query'] = array(
              array(
                  'key' =&gt; 'event_start',
                  'compare' =&gt; '&lt;',
                  'value' =&gt; $today
              )
          );
      } else {
          $args['meta_query'] = array(
              array(
                  'key' =&gt; 'event_start',
                  'compare' =&gt; '&gt;',
                  'value' =&gt; $today
              )
          );
      }
  
      $args['order'] = 'ASC';
      $args['orderby'] = 'meta_value';
      $args['meta_key'] = 'event_start';
  
  }
  
  $the_query = new WP_Query( array_merge($wp_query-&gt;query, $args) );
  </code></pre>
  
  <p>I'm getting out the posts and then at the bottom I want a pagination feature.</p>
  
  <p>Here is my pagination query</p>
  
  <pre><code>$args = array(
      'base'      =&gt; add_query_arg( 'pagenum', '%#%' ),
      'add_args'  =&gt; true,
      'format'    =&gt; '/page/%#%',
      'current'   =&gt; max( 1, get_query_var('paged') ),
      'total'     =&gt; $wp_query-&gt;max_num_pages,
      'prev_next' =&gt; true,
      'prev_text' =&gt; __('« Previous'),
      'next_text' =&gt; __('Next »'),
      'end_size'  =&gt; 3,
      'type'      =&gt; 'list'
  );
  
  echo paginate_links($args);
  </code></pre>
  
  <p>But whats happening is the link at the bottom is showing the url twice like this </p>
  
  <pre><code>http://domain.com/category/recent-seminars/page/2domain.com/category/recent-seminars/page/2/?future
  </code></pre>
  
  <p>This results in 'Nothing Found' (unsurprising), but even if I delete either the first half or second half, I still get nothing found.</p>
  
  <p>I've tried loads of different combinations in the paginate_links query but nothing is working.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I've amended the main query to this now</p>
  
  <pre><code>$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
  
  $args = array(
      'post_type' =&gt; 'post',
      'category__in' =&gt; array($category[0]-&gt;cat_ID),                      
      'paged'     =&gt; $paged
  );
  
  $today = date('Ymd');
  
  if ($category[0]-&gt;cat_ID == 3) {
  
      $args['meta_key'] = 'event_start';
      $args['meta_query'] = array(
          array(
              'key'       =&gt; 'event_start',
              'compare'   =&gt; '&gt;=',
              'value'     =&gt; $today
          )
      );
      $args['order'] = 'ASC';
      $args['orderby'] = 'meta_value_num';
  
  }
  </code></pre>
  
  <p>This works for the first page, but as soon as I click one of the next page links, it stops working, however If i take out the <code>$args['meta_query']</code> array, the paging does work, but the posts are in the wrong order.</p>