[wp-trac] [WordPress Trac] #25207: Restore the ability to short-circuit core redirects

WordPress Trac noreply at wordpress.org
Sun Sep 1 23:52:31 UTC 2013


#25207: Restore the ability to short-circuit core redirects
--------------------------+-----------------------------
 Reporter:  DrewAPicture  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  3.1
 Severity:  normal        |   Keywords:  has-patch
--------------------------+-----------------------------
 When the `wp_redirect` filter was added in [4407], the point was to make
 it possible to "cancel" a redirect by filtering the location. However,
 following [16847], `exit;` calls for `wp_redirect()` were added all over
 core.

 The problem with adding `exit` in the ''way'' we did in [16847], was that
 it thereafter prevented short-circuiting a redirect because `exit` is
 called whether the redirect is canceled or not.

 So in that vein, rather than doing:
 {{{
 #!php
 <?php
 wp_redirect( admin_url( 'something' ) );
 exit;
 }}}

 We should take a cue from [24996] and check for a successful redirect
 before exiting.
 {{{
 #!php
 <?php
 if ( wp_redirect( admin_url( 'something' ) ) )
         exit;
 }}}

 Patch attached.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25207>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list