title: Only first link of Pagination working in Custom Wordpress Plugin
body: <p>I am trying to integrate Pagination functionality into my Wordpress Custom Plugin. This plugin fetches the input and displays the results via Ajax.</p>
  
  <p>When the results row are more than 7, I am using pagination. In this case, numeric link "1" is showing correct data whereas the rest of link it redirects to the <a href="http://accessrealtytampa.com/wp-admin/admin-ajax.php/page/2/" rel="nofollow noreferrer">Admin Ajax Link</a>.</p>
  
  <p>How can I make rest of the link make it work?</p>
  
  <pre><code>global $wpdb;
      $data = $wpdb-&gt;get_results($wpdb-&gt;prepare("SELECT * FROM `wp_gj73yj2g8h_hills_school_data` " . $where_query_text  . ";"));
      $rows_per_page = 7;
      $current = (intval(get_query_var('paged'))) ? intval(get_query_var('paged')) : 1;
  
  
      $data = $wpdb-&gt;get_results($wpdb-&gt;prepare("SELECT * FROM `wp_gj73yj2g8h_hills_school_data` " . $where_query_text  . ";"));
  
      global $wp_rewrite;
      $pagination_args = array(
      'base' =&gt; @add_query_arg('paged','%#%'),
      'format' =&gt; '',
      'total' =&gt; ceil(sizeof($data)/$rows_per_page),
      'current' =&gt; $current,
      'show_all' =&gt; false,
      'type' =&gt; 'plain',   
      );
  
  
  
  if( $wp_rewrite-&gt;using_permalinks() )
   $pagination_args['base'] = user_trailingslashit( trailingslashit( remove_query_arg('s',get_pagenum_link(1) ) ) . 'page/%#%/', 'paged');
  
  if( !empty($wp_query-&gt;query_vars['s']) )
   $pagination_args['add_args'] = array('s'=&gt;get_query_var('s'));
  
      $output_string = '';
  
      $output_string .= paginate_links($pagination_args);
  
      $start = ($current - 1) * $rows_per_page;
      $end = $start + $rows_per_page;
      $end = (sizeof($data) &lt; $end) ? sizeof($data) : $end;
  
      $output_string .= '&lt;br&gt;';
  
      $output_string .= '&lt;div class="clearfix row"&gt;';
      $output_string .= '&lt;div class="columns small-12 large-12"&gt;';
      $output_string .= '&lt;h2 class="school-heading"&gt;&lt;em&gt;Schools&lt;/em&gt;&lt;/h2&gt;';
      $output_string .= '&lt;div class="horizontalLine"&gt;&lt;/div&gt;';
      $output_string .= '&lt;/div&gt;';
      $output_string .= '&lt;/div&gt;'; 
      for($i=$start;$i &lt; $end; ++$i)
      {
          $rows = $data[$i];
          /*Displays the Content*/            
      }
  </code></pre>