title: Pagination in archive.php Wordpress
body: <p>I'm working on a paginations for listing multiple articles :</p>
  
  <p>Here's what I wrote so far : </p>
  
  <p><strong>archive.php</strong></p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;div class="row"&gt;
  
      &lt;?php
          $args = array( 
              'posts_per_page' =&gt; 4,
              'category_name' =&gt; 'actualites',
              'paged' =&gt; get_query_var('paged') ? get_query_var('paged') : 1
          );
  
          $myposts = new WP_Query($args);
      ?&gt;
  
  
  
          &lt;div class="bloc-content col-lg-10 col-md-9 col-sm-12 col-xs-12"&gt;
              &lt;h1 class='page-title'&gt;&lt;span&gt;&lt;?php single_term_title(); ?&gt;&lt;/span&gt;&lt;/h1&gt;
              &lt;?php if ( $myposts-&gt;have_posts() ) : ?&gt;
  
                  &lt;?php while ( $myposts-&gt;have_posts() ) : $myposts-&gt;the_post(); ?&gt;
  
                      &lt;?php get_template_part( 'content', get_post_format() );?&gt;
  
                  &lt;?php endwhile; wp_reset_postdata();?&gt;
  
              &lt;?php endif; ?&gt;
              &lt;?php if (($myposts-&gt;max_num_pages) &gt; 1) { ?&gt;
  
                  &lt;nav class="custom-pagination"&gt;
                      &lt;?php echo pagination($myposts); ?&gt;
                  &lt;/nav&gt;
  
              &lt;?php } ?&gt;
          &lt;/div&gt;
          &lt;div class="sidebar col-lg-2 col-md-3 col-sm-12 col-xs-12"&gt;
              &lt;?php get_sidebar(); ?&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The pagination is displaying just fine but when I click onto next button, I'm redirecting to a 404 page.</p>
  
  <p>Thanks for your help !</p>