Skip to content

Instantly share code, notes, and snippets.

@nirbhay18
Created October 19, 2020 11:54
Show Gist options
  • Save nirbhay18/c43fbfef8a9d95384088f1b68aa7e384 to your computer and use it in GitHub Desktop.
Save nirbhay18/c43fbfef8a9d95384088f1b68aa7e384 to your computer and use it in GitHub Desktop.
Fix pagination issues on CPT Singular Layout Ref#17568
function _wp_adjust_show_request( $request ) {
if ($request->query_vars['post_type'] === 'project' && $request->is_singular === true && $request->current_post == -1 && $request->is_paged === true ) {
add_filter( 'redirect_canonical', '__return_false' );
}
return $request;
}
add_action( 'parse_query', '_wp_adjust_show_request' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment