Secondary loop pagination on custom post type single post gets redirected to first page

I found the answer. I had searched high and low yesterday, but today I finally found it: https://wordpress.stackexchange.com/a/143837/10595

add_action('template_redirect', function() {
  if ( is_singular('posttype') ) {
    global $wp_query;
    $page = (int) $wp_query->get('page');
    if ( $page > 1 ) {
      // convert 'page' to 'paged'
      $query->set( 'page', 1 );
      $query->set( 'paged', $page );
    }
    // prevent redirect
    remove_action( 'template_redirect', 'redirect_canonical' );
  }
}, 0 ); // on priority 0 to be able removing 'redirect_canonical' added with priority 10

This, copied to my functions.php, makes WordPress recognize the paged parameter on single posttype entries.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)