[wp-trac] [WordPress Trac] #60208: Prevent redirect loops

WordPress Trac noreply at wordpress.org
Fri Sep 27 00:07:00 UTC 2024


#60208: Prevent redirect loops
-------------------------------------------------+-------------------------
 Reporter:  kkmuffme                             |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Bootstrap/Load                       |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch dev-feedback has-unit-     |     Focuses:
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by kkmuffme):

 A common case I found is where the url is an admin URL (e.g. /wp-admin/)
 but the request came in via a frontend PHP handler, e.g.
 DOCUMENT_URI="/index.php"

 The `add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000
 );` callback will create an infinite redirect loop via this particular
 part of the code in that callback

 ```
 if ( in_array( untrailingslashit( $_SERVER['REQUEST_URI'] ), $admins, true
 ) ) {
         wp_redirect( admin_url() );
         exit;
 }
 ```

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60208#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list