title: pagination is not working after rewrite url of custom post type
body: <p>I have try this function to rewrite url of custom post.
  Here is my code for url rewrite,</p>
  
  <pre><code>add_filter('post_type_link', 'brand_permalink', 1, 3);
  function brand_permalink($permalink, $post_id, $leavename) {
  
  if (strpos($permalink, '%campaign-responses-category%') === FALSE) return  $permalink;
  
      $post = get_post($post_id);
      if (!$post) return $permalink;
  
      // Get taxonomy terms
      $terms = wp_get_object_terms($post-&gt;ID, 'campaign-responses-category');
      if (!is_wp_error($terms) &amp;&amp; !empty($terms) &amp;&amp; is_object($terms[0]))
          $taxonomy_slug = $terms[0]-&gt;slug;
      else $taxonomy_slug = 'no-brand';
      return str_replace('%campaign-responses-category%', $taxonomy_slug,  $permalink);
  }
  </code></pre>
  
  <p>Here is the Code For Pagination.</p>
  
  <pre><code>function wpbeginner_numeric_posts_nav() {
  
  if( is_singular() )
      return;
  
  global $wp_query;
  
  /** Stop execution if there's only 1 page */
  if( $wp_query-&gt;max_num_pages &lt;= 1 )
      return;
  
  $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
  $max   = intval( $wp_query-&gt;max_num_pages );
  
  /** Add current page to the array */
  if ( $paged &gt;= 1 )
      $links[] = $paged;
  
  /** Add the pages around the current page to the array */
  if ( $paged &gt;= 3 ) {
      $links[] = $paged - 1;
      $links[] = $paged - 2;
  }
  
  if ( ( $paged + 2 ) &lt;= $max ) {
      $links[] = $paged + 2;
      $links[] = $paged + 1;
  }
  
  echo '&lt;div class="pager"&gt;&lt;div class="pages wp-compaign"&gt;' . "\n";
  
  /** Previous Post Link */
  if ( get_previous_posts_link() )
      printf( '&lt;li style="display: inline-block;list-style: none;"&gt;%s&lt;/li&gt;' . "\n", get_previous_posts_link() );
  
  /** Link to first page, plus ellipses if necessary */
  if ( ! in_array( 1, $links ) ) {
      $class = 1 == $paged ? ' class="active"' : '';
  
      printf( '&lt;li%s style="display: inline-block;list-style: none;"&gt;&lt;a class="page larger" href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
  
      if ( ! in_array( 2, $links ) )
          echo '&lt;li style="display: inline-block;list-style: none;"&gt;…&lt;/li&gt;';
  }
  
  /** Link to current page, plus 2 pages in either direction if necessary */
  sort( $links );
  foreach ( (array) $links as $link ) {
      $class = $paged == $link ? ' class="active"' : '';
      printf( '&lt;li%s style="display: inline-block;list-style: none;"&gt;&lt;a  class="page larger" href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;' . "\n", $class, esc_url(  get_pagenum_link( $link ) ), $link );
   }
  
  /** Link to last page, plus ellipses if necessary */
  if ( ! in_array( $max, $links ) ) {
      if ( ! in_array( $max - 1, $links ) )
          echo '&lt;li style="display: inline-block;list-style: none;"&gt;…&lt;/li&gt;' .  "\n";
  
      $class = $paged == $max ? ' class="active"' : '';
      printf( '&lt;li%s style="display: inline-block;list-style: none;"&gt;&lt;a   class="page larger" href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;' . "\n", $class, esc_url(   get_pagenum_link( $max ) ), $max );
    }
  
   /**    Next Post Link */
   if ( get_next_posts_link() )
      printf( '&lt;li style="display: inline-block;list-style: none;"&gt;%s&lt;/li&gt;' .   "\n", get_next_posts_link() );
  
   echo '&lt;/div&gt;&lt;/div&gt;' . "\n";
  
   }
  </code></pre>
  
  <p>The pagination link is <a href="http://example.com/site-name/campaign-responses/page/2/" rel="nofollow">http://example.com/site-name/campaign-responses/page/2/</a>
  But its getting 404 error page not found.
  once i delete .htaccess and remove the function of rewrite url but still getting 404 error.Please can any one help me. Thank You in advance.</p>