WP Paginate with ajax Sorting request

I have a page that show some post.

Now i have a button and can sorting with ajax the posts (by date,id ecc).

But the pagination automatic get the $_SERVER[‘REQUEST_URI’]; from ajax request
and all link from paginate will be wrong

sorry maybe i can’t explain better my issue maybe the code can help.

This is my pagination function:

$big    =   999999999;
            $pages  =   paginate_links(array(
                            'base'  =>  str_replace($big,   '%#%',  get_pagenum_link($big)),
                            'format'    =>  '?page=%#%',
                            'current'   =>  max(1,  get_query_var('page')),
                            'total' =>  $loop->max_num_pages,
                            'prev_text' =>  __('"'),
                            'next_text' =>  __('»'),
                            'type'  =>  'array',

Now when i sorting the posts with ajax request, the link are all so

How can solve this problem?
Maybe i need to customize my pagination function?(i not know how)

Read more here: WP Paginate with ajax Sorting request

Leave a Reply

Your email address will not be published. Required fields are marked *