Martin’s fix works, but a better solution is to use the pre_get_posts function.
Example:
function custom_type_archive_display($query) {
if (is_post_type_archive('custom_type')) {
$query->set('posts_per_page',1);
return;
}
}
add_action('pre_get_posts', 'custom_type_archive_display');
Related Posts:
- pagination not working for category.php (custom post types in categories)
- Custom WP_Query always respond with 200 status even when no entry
- Custom post type blog pagination conflict
- send user to first page of results when reposting to page?
- Pagination throws 404 error on custom taxonomy archive pages
- Number of pages – multiple (custom) post types
- Display Custom Post Type Fields
- Custom permalink with pagination
- Retrieving 3 latest post from each of 5 different custom post types
- Pagination Doesn’t Work
- how to group custom post type posts by custom taxonomy terms
- Numeric pagination custom post type
- Custom wp_query pagination – next_posts_link() or wp_pagenavi() always empty
- Using Query Posts With Multiple Post Types And A Taxonomy
- How to get the parent’s taxonomy?
- posts_nav_link on single post template
- Custom Taxonomy archive returns 404
- Query not returning CPT posts
- Pagination gives 404 error
- Unable to display multiple post types in same query (WPML WP_Query)
- Pagination with custom post types results in 404 issues
- Pagination not working
- Pagination Issue: Custom Post Type In Index
- Quickest way to get last or oldest post date – WP Query
- Custom query form submission pagination
- Paginated Taxonomy Term Archive including one post per term
- Separate Posts and Custom Post Type in Custom Taxonomy archive template
- Custom query shows custom post types in trash
- Unable to get paginate_links working with a custom query [duplicate]
- Setting posts per page in query_posts
- Pagination on category page with custom post types
- Sorting multiple custom post types without a meta key/value pair by sort order
- Pagination : How to remove /page/x/ after a ‘POST’ action on a form returning to page 1
- Pagination on a custom post type loop
- Display custom post type from dynamic custom field
- Query/list all terms and their custom post count
- Archive for custom taxonomy lists all posts instead of current taxonomy
- Wrong request query on cpt and tax
- Previous/Next Link by Meta Value in CPT
- Pagination for Custom Taxonomy Page [duplicate]
- Pagination on with query_posts in custom post type template
- Get latest 3 posts from multiple CPT in one query
- Help with Elementor Pagination CPT archive 404 problem
- Custom taxonomy rewrite give pagination 404
- Woocommerce search pagination not working
- How do you paginate a query grouped by month?
- Polylang non-default language ignores tags in WP_Query
- Pagination with custom query, custom search form, single and pages, ajax and no plugins
- How to display Related Posts based on number of taxonomy terms matched
- Custom post type pagination 404
- Pagination doesn’t function properly for archive of a custom post type set as the front page
- Trouble with pagination
- Pagination 404 on Index with custom query
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- Pagination not working on custom query on a page
- postsperpage value not being applied
- Pagination for search results of custom post type [duplicate]
- Custom Post Type Archive Pagination
- All blog posts are not showing up
- Single parent post lists child posts with pagination
- Custom post type pagination error
- Custom Post Type ‘Event’: Chronological list of recurring events from meta_values in array
- Sorting the Loop by Taxonomy Value
- Previous / Next Links For Custom Post Type Sorted By Meta_Value
- Problem with custom loop navigation inside the blog page
- Custom Query: Multiple CPTs and a taxonomy filter
- WP query_posts group by meta field related
- custom taxonomy pagination 404 error
- Sticky posts limit query and pagination for a custom post type
- Custom wp-query display post only today
- Pagination in custom post type archive.php not working
- custom post type and a “sticky” position taxonomy
- Pagination Not Working When Used With WP_Query() `offset` Property
- Numeric pagination custom post type
- Use WP_query to match post types based on custom field values
- Problems in paginate_links with custom query loop and MB-Relationships
- Make pagination work as a carousel (custom query)
- minimize wp_query call to database
- Pagination for custom query returns 404
- Query the title of the page to show posts with matching category in the loop
- pre_get_posts gives 404 error on Custom Post
- 404 error next-page [2] PageNavi custom type taxonomy
- Main site single-property.php design, as homepage of a multisite
- Custom Post Type shows pagination (w/404) or posts_per_page query, but not both
- Imported Content Doesnt Show Up On Frontend
- display news with pictures 3 small and one large (loop)
- Pagination in custom loop for custom post type throwing 404 error
- Custom post type pagination, single page issue
- Pagination always adding “Next” link when results come from Custom Post Type WP_query
- Query Posts From Multiple Post Types
- Pagination not working on homepage
- How do I paginate a custom post type listing on a custom template page?
- Fourth page of custom post type archive page does not exist
- Pagination broke after updateto WordPress 3.4 [duplicate]
- WordPress custom post type post and category links 404
- Archive page – problem with pagination
- How do I correctly query posts from a post ID?
- Pagination on category pages using wp_pagenavi causes 404 errors
- Quering array of post types & pagination. Articles are repeating sometimes on different pages
- Assign a tag to custom post type using a query