function wphelp_custom_pre_get_posts( $query ) {
if( $query->is_main_query() && !$query->is_feed() && !is_admin() && is_category()) {
$query->set( 'paged', str_replace( "https://wordpress.stackexchange.com/", '', get_query_var( 'page' ) ) ); } }
add_action('pre_get_posts','wphelp_custom_pre_get_posts');
function wphelp_custom_request($query_string ) {
if( isset( $query_string['page'] ) ) {
if( ''!=$query_string['page'] ) {
if( isset( $query_string['name'] ) ) { unset( $query_string['name'] ); } } } return $query_string; }
add_filter('request', 'wphelp_custom_request');
I have used this code and it helped me through for now.
Related Posts:
- Pagination shows 404 after a certain number of pages
- Pagination causes error 404 when used with front-page.php
- Intentionally exceed max_num_pages on main query without getting 404?
- Custom pagination with WP_Query generating 404 error
- How to return a 404 when custom query matches nothing?
- paged variable not working for category/custom post archive
- Pagination with Custom Post Type not working on index.php: I get a 404
- taxonomy-{term}.php terms pagination returning 404 after a certain page
- Pagination when using wp_query?
- How can i retrieve default post per page value? from settings->reading. And total number of posts?
- Find out total number of pages in global query on archive page?
- Post_count only shows the number of results per page
- Multiple WP_Query loops with Pagination
- Pagination with custom SQL query
- Why is the loop not empty on some 404s?
- WordPress Pagination Not Working – Always Showing First Pages Content
- get_query_var function not working at all
- get_query_var( ‘paged’ ) not working outside of homepage
- Pagination on a WP_query not showing navigation links
- Different ‘posts_per_page’ setting for first, and rest of the paginated pages?
- How to paginate wordpress [gallery] shortcode?
- Pagination returns 404 after page 20
- paginate_links() adds empty href to first page and previous link
- Custom post type archive 404’s with paginate_links
- paginate_links ignore my format
- Combining two wordpress queries with pagination is not working
- Custom WP_Query order by post_meta and (author) user_meta
- How to paginate attachments in a secondary query as gallery?
- Pagination with WP_Query is buggy – working for some pages, but not the others
- Get the number of posts from the current page results
- WP_Query and Pagination on a Static front page
- next_posts_link not working for loop called with ajax
- Query causing load because of SQL_CALC_FOUND_ROWS post counting?
- How to trigger 404 for custom query var?
- Why does pagination always break when used on any form of a home page?
- Pagination with 5 posts per page
- Pagination custom query
- Pagination not working for Custom search form & custom result template
- Pagination/infinite scroll with WP_Query and multiple loops
- How to adjust found_posts so that it accounts for offset and pagination
- Pagination broken when merging search results with additional WP_Query
- WP_query and pagination?
- pagenavi with merged wp_query [duplicate]
- Add and in the header while looping over custom query in page template
- pagination doesn’t show up for custom post type
- Paginated pages are showing correct content but pagination links are not
- Query with pre_get_posts to get pagination
- Pagination wont work with search results template [duplicate]
- Pagination Not working on Home Page with 2 Query
- Best Practice For Querying Grandchildren?
- Pagination not working on static page
- ‘paged’ in wp_query doesn’t work
- Display different number of posts from one category on the different pages
- Pagination not working Search posts
- Pagination not working for category posts
- Pagination is not working using WP_Query
- WP Query with offset breaks wp_pagenavi or any pagination
- Search – Ajax – Alter Query Parameters with Pagination
- Two queries on the same page with pagination
- Transient pagination not working properly
- WP-PageNavi gives me a 404 when using WP Query
- Injecting content with $wp_query->current_post restarts from zero on paged pages. How to inject content after X posts, regardless of pagination?
- Show single post then all posts (with pagination)
- Is there a PHP function that can match anything after the given URL, so my IF statement will work in each instance?
- Add custom search results to main WP search [duplicate]
- Woocommerce custom loop to show all the products [closed]
- How to bring specific post to front of wordpress loop?
- Pagination for custom query on single.php
- Merged two WP_Queries, posts per page and pagination not working
- Pagination doesn’t work in custom page template [duplicate]
- WP_Query pagination not working in admin area
- Pagination 404 errors for author posts query on author.php
- WordPress pagination link always leads to home page
- WP_QUERY loop, offset in the arguments and the paginate_links – can these work together?
- Pagination problem after WP_Query with tag filtering
- Too many posts cause slow load when paginating
- Pagination stops at page 6
- Paginated HTML Sitemap
- How to output different posts per page?
- Multiple WP_Query loops with Pagination Not Working
- Posts loop with pagination on a single post page
- Pagination working everywhere but the index page
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- if/else on custom query gives 200 OK when condition not met?
- WP_Query ajax loader detect end of posts
- Offset Page Loops and Pagination
- Pagination is broken and I need help fixing it
- Have functions work outside the loop with 404 override
- Storing query variable and then using wp_reset_query
- Pagination of a WP_Query Loop in a child-page page template
- WP Pagination on Posts Search Results Page resulting from AJAX WP Query
- Create A Loop With A Variable Number of Posts For Each Bootstrap Row?
- How to set pagination to work with ‘/page/’?
- Five posts from a category in footer
- The pagination on index.php doesn’t work on a first page
- paging in WP_Query on static page
- Get pagination working for custom loops within page templates
- WP_Query Pagination on multiple-loop page breaks WP or doesn’t show up
- WordPress Pagination changes my template
- wp_query ‘s’, search filter with pagination is not working