Pagination for custom query throws 404 errors on last pages [duplicate]
Exactly what @Pieter Goosen said. Not only are you creating havoc for WordPress, you’re adding unnecessary load on the server by introducing more queries on top of the main query: function wpse_176933_custom_authors_archive( $wp_query ) { if ( $wp_query->is_main_query() && $wp_query->is_author() ) { $wp_query->set( ‘posts_per_page’, 4 ); $wp_query->set( ‘post_type’, ‘publikasjoner’ ); $wp_query->set( ‘meta_key’, ‘rapportnummer’ ); $wp_query->set( … Read more