title: Pagination in custom post type in wordpress
body: <p>I am try to put pagination in my custom post in wordpress.  my custom post type name is videos. it appears the pagination but when I click on the pagination page it goes to 404 page.</p>
  
  <pre><code>&lt;?php 
  $videos= new WP_Query(array(
      'post_type'=&gt;'videos',
      'posts_per_page' =&gt; 9,
  
  ));?&gt;
  
  
  &lt;?php if($videos-&gt;have_posts()) : ?&gt;
      &lt;?php while($videos-&gt;have_posts())  : $videos-&gt;the_post(); ?&gt;
          &lt;div class="col-xs-12 col-sm-6 col-md-4 col-lg-4"&gt;
              &lt;div class="video"&gt;
                  &lt;?php the_post_thumbnail(); ?&gt;
                  &lt;div class="watch"&gt;
                      &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;i class="fa fa-play"&gt;&lt;/i&gt;&lt;/a&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
              &lt;div class="video-exerpt"&gt;
                  &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
      &lt;?php endwhile; ?&gt;
      &lt;div class="col-xs-12 text-center"&gt;
          &lt;?php
              $GLOBALS['wp_query'] = $videos; 
  
              the_posts_pagination(
                  array(
                      'mid_size' =&gt; '2',
                      'prev_text' =&gt; '&lt;i class="fa fa-hand-o-left"&gt;&lt;/i&gt; Previous',
                      'next_text' =&gt; 'Next &lt;i class="fa fa-hand-o-right"&gt;&lt;/i&gt;',
                      'screen_reader_text' =&gt; ' '
                      )
              );
          ?&gt;
      &lt;/div&gt;
  &lt;?php else :?&gt;
      &lt;h3&gt;&lt;?php _e('404 Error&amp;#58; Not Found', 'Bangladesh Parjatan'); ?&gt;&lt;/h3&gt;
  &lt;?php endif; ?&gt;
  &lt;?php wp_reset_postdata();?&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/fLMKp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fLMKp.jpg" alt="enter image description here"></a></p>
  
  <p>its shows the pagination bt the links are not working. Please help me.</p>