Change predefined posts_per_page to minimum value in wordpress settings or add code below to functions.php. WordPress using default parameter. For example: 10. And if your settings in query_posts or WP_Query look like “posts_per_page=>2” and number of posts in custom post type less then 10, after clicking to /page/2/ you will redirected to page 404.
Use this code for functions.php for solve problem:
if( !is_admin() ){
add_action( 'pre_get_posts', 'set_per_page' );
}
function set_per_page( $query ) {
global $wp_the_query;
if($query->is_post_type_archive('tutorial')&&($query === $wp_the_query)){
$query->set( 'posts_per_page', 1);
}
return $query;
}
Related Posts:
- Pagination throws 404 error on custom taxonomy archive pages
- Custom Taxonomy archive returns 404
- Custom post type pagination 404
- 404 error next-page [2] PageNavi custom type taxonomy
- What am I doing wrong with my taxonomy?
- Custom post type pagination 404 fix?
- Custom post type archive 404’s with paginate_links
- WordPress Custom Post Type Category Page
- Best Way to Leverage Custom Post Type Related Content and Consider SEO
- custom post type paging not working past page 3
- Pagination gives 404 error
- Custom Taxonomy 404
- Pagination with custom post types results in 404 issues
- Paginated Taxonomy Term Archive including one post per term
- Custom Permalink with Dynamic Taxonomy for Custom Post Type – Works, but breaks other permalinks
- Custom Post Type Pagination & duplicate posts
- custom post type and custom taxonomy url conflict
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- How To Create A Custom Taxonomy 404 Page
- Repeating posts when paginating random posts
- Bizarre Permalinks Issue: 404 Errors Everywhere
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Custom taxonomy in URL showing 404
- Custom Post Type / Two level deep taxonomy (cat. and subcat.) uri problem (error 404)
- Wrong request query on cpt and tax
- Pagination for Custom Taxonomy Page [duplicate]
- Custom Post Types, URL rewrite on multiple CPTs
- Get Taxonomy Term Title by it’s URL
- Help with Elementor Pagination CPT archive 404 problem
- How do I move/order posts with a tag to the end?
- Custom taxonomy rewrite give pagination 404
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- Custom post URL 404 error
- WordPress randomly shows 404 errors
- Custom Post Type Pagination Paginates Only in URL Structure
- Custom post type permalink tag 404
- Custom post type / taxonomy rewrite archive page 2 gives 404
- Querying Custom Post Type, ordering by Custom Taxonomy Pagination Not Working
- Hierarchical permalinks for custom post type and taxonomy
- Top Level pages in wordpress giving 404, but child pages working fine
- Taxonomy in URL
- How to solve this custom post type goes to 404 page?
- Pagination Not Working for Custom Taxonomy with Custom Query – 404 Error
- Custom WP_Query always respond with 200 status even when no entry
- Can’t use pagination with custom taxonomy
- Custom taxonomy page returns 404
- previous_post_link in same taxonomy in custom post type
- Custom taxonomy template list not working (404)
- How to filter a custom post type by custom taxonomy without 404
- Custom post type and custom taxonomy 404 on page 2
- How to list custom post types on a custom post type page?
- Custom post type categories gives 404 error
- Taxonomy rewrite pagination 404
- Custom Post Type URL Rewrite’s
- Safe to throw 404 error in request filter?
- either single-{custom}.php 404’s OR /taxonomy/ 404’s – custom post type and taxonomy permalinks
- 2 custom post type paging in 1 custom taxonomy
- Problem with custom loop navigation inside the blog page
- custom taxonomy pagination 404 error
- Custom archive page for custom taxonomy and pagination issue
- how to achieve this permalink abc.com/CPTName/CustomPostTypeCategorySlug/categoryname
- Custom post type paging return home page
- URL for archive of custom post type with 2 taxonomy terms
- Remove custom taxonamy slug with pagination
- Custom taxonomy returns 404 even with saving permalinks
- pagination problem listing custom post types of taxonomy in wordpress
- WordPress custom post type taxonomy paging
- How to display custom post type pagination buttons when processing AJAX request
- Why is my loop not populating the page with my custom taxonomy terms from my custom post type?
- Pagination for custom query returns 404
- CPT/Taxonomy/Postname permalink structure makes pagination break
- Pagination with a custom post type
- I want to create pagination for my custom post type archive that i am displaying with loop
- Pagination not working (page/2 retunring 404 page)
- Making permalink for custom post type/custom taxonomy. Stuck with 404 in the single post
- Pods pagination erases my sub menu
- Force WordPress to only match URL in category
- Custom taxonomy in custom post type archive with pagination
- Pagination fault in custom post type archive page [duplicate]
- Paginate custom taxonomy category with wp_custom_pagination
- Pagination in custom loop for custom post type throwing 404 error
- Pagination for a Custom Taxonomy
- Customize category URL
- Remove custom taxonomy ‘post-type’ from post URL
- Pagination URL order
- how to limit query_post to first page?
- Sorting custom post types by taxonomy (So close)
- How do I paginate a custom post type listing on a custom template page?
- Tags and Taxonomy links not working for Custom Post Types
- WordPress custom post type post and category links 404
- WordPress pagination URL
- See the process of creating a taxonomy and tell me where I made a mistake
- 404 Error On Custom Taxonomy Pages 2, 3, etc
- Pagination on category pages using wp_pagenavi causes 404 errors
- Links in archive not including taxonomy parameter
- the_post_navigation in single page with multiple taxonomies
- Custom Post Type with multiple Custom Taxonomies / Hide Taxonomy Slug from URL
- Hide custom post type slug url from search engine [closed]
- Custom post type with custom taxonomies structure url not working archive of CPT
- Is it possible to use a post name in a custom post slug?