[wp-trac] [WordPress Trac] #60926: Missing calling `exit` after using `wp_redirect`

WordPress Trac noreply at wordpress.org
Sat Jun 22 11:41:51 UTC 2024


#60926: Missing calling `exit` after using `wp_redirect`
--------------------------------+----------------------------------------
 Reporter:  jigar bhanushali    |       Owner:  (none)
     Type:  defect (bug)        |      Status:  new
 Priority:  normal              |   Milestone:  6.6
Component:  Networks and Sites  |     Version:
 Severity:  normal              |  Resolution:
 Keywords:  has-patch           |     Focuses:  administration, multisite
--------------------------------+----------------------------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch close => has-patch
 * milestone:  Awaiting Review => 6.6


Comment:

 Replying to [comment:6 rajinsharwar]:
 > Just to put some context, we use wp_redirect() in multiple places in the
 core where we want to continue the page processing after doing the
 redirect. So, exiting within the function will break the core a lot, as
 well as plugins or themes using it, in case they are also processing after
 redirect.

 Unless I'm missing something, this ticket does not suggest placing an
 `exit` call within the ` wp_redirect()` function. It only suggests adding
 the call in a specific place at the end of `wp-admin/ms-options.php`,
 which should not break anything.

 Taking a closer look, there is already an `exit` call after
 `wp_redirect()` in the same exact pattern in these files:
 * `wp-admin/moderation.php`
 * `wp-admin/ms-admin.php`
 * `wp-admin/ms-edit.php`
 * `wp-admin/ms-sites.php`
 * `wp-admin/ms-themes.php`
 * `wp-admin/ms-upgrade-network.php`
 * `wp-admin/ms-users.php`

 See [16847] / #15518. It's only missing in `wp-admin/ms-options.php` by
 accident, so while an `exit` call might seem redundant here,
 [attachment:"60926.patch"] brings more consistency with the other files.

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


More information about the wp-trac mailing list