I have allow readers to select the posts order with different parameters. For a example users can order posts by "vote". (Vote is a custom post type.)
Then URL will be http://example.com/?sort_by_type=vote
I have used pre_get_posts
action to do orderthe posts. It works fine. The problem is pagination .
Pagination look like this in my theme.
http://example.com/?sort_by_type=vote/page/2/
But it should be http://example.com/page/2/?sort_by_type=vote
to work correctly.
So how I correct pagination?
Edit After comment of @govind : The theme which I used is a not a theme developed by me. What I did i, if URL contain ?sort_by_type=vote
request I changed the post order using pre_get_posts
filter.
When I cheeking theme I found following code.
<?php if ( is_home() || is_archive() || is_search() ) : // If viewing the blog, an archive, or search results. ?>
<?php loop_pagination(
array(
'prev_text' => _x( '← Previous', 'posts navigation', 'daily' ),
'next_text' => _x( 'Next →', 'posts navigation', 'daily' )
)
); ?>
<?php endif; ?>