WordPress.org

Make WordPress Core

Ticket #16357: 16357.fix.diff

File 16357.fix.diff, 1.3 KB (added by garyc40, 3 years ago)

fix redirect loop in users.php, network/users.php, edit-tags.php

  • wp-admin/edit-tags.php

    diff --git wp-admin/edit-tags.php wp-admin/edit-tags.php
    index 613855f..5db9aaf 100644
    if ( ! empty($_REQUEST['_wp_http_referer']) ) { 
    162162$wp_list_table->prepare_items(); 
    163163$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    164164 
    165 if ( $pagenum > $total_pages ) { 
     165if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    166166        wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    167167        exit; 
    168168} 
  • wp-admin/network/users.php

    diff --git wp-admin/network/users.php wp-admin/network/users.php
    index c87bfd3..6523c98 100644
    $pagenum = $wp_list_table->get_pagenum(); 
    2121$wp_list_table->prepare_items(); 
    2222$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    2323 
    24 if ( $pagenum > $total_pages ) { 
     24if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    2525        wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    2626        exit; 
    2727} 
  • wp-admin/users.php

    diff --git wp-admin/users.php wp-admin/users.php
    index 65ce4a5..e557d45 100644
    default: 
    291291 
    292292        $wp_list_table->prepare_items(); 
    293293        $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 
    294         if ( $pagenum > $total_pages ) { 
     294        if ( $pagenum > $total_pages && $total_pages > 0 ) { 
    295295                wp_redirect( add_query_arg( 'paged', $total_pages ) ); 
    296296                exit; 
    297297        }