Make WordPress Core

Opened 7 years ago

Closed 5 years ago

#42108 closed enhancement (fixed)

Pass on the return from wp_redirect for wp_safe_redirect

Reported by: drivingralle's profile Drivingralle Owned by: johnbillion's profile johnbillion
Milestone: 5.1 Priority: normal
Severity: normal Version: 2.3
Component: General Keywords:
Focuses: Cc:

Description

While browsing WP documentation I noticed that the wp_redirect function returns a bool so a script can react to it.
https://developer.wordpress.org/reference/functions/wp_redirect/#description

As it's recommended to use wp_safe_redirect to redirect within the site. It would be good to make them exchangeable. So developers can more easy enhance code within there plugins to make it more safe. Even if they rely on the returned value.

Pro:
Both functions work more uniformly.

Con:
I can't think of downsides.


I attempted to create a patch.

Attachments (4)

pass_the_return_from_wp_redirect_on.patch (1.5 KB) - added by Drivingralle 7 years ago.
pass the return from wp_redirect on
pass_the_return_from_wp_redirect_on_clean.patch (1.3 KB) - added by Drivingralle 7 years ago.
Same patch. Without code style changes. Better doc block.
pass_the_return_from_wp_redirect_on_clean - 5-0-1.patch (1.3 KB) - added by Drivingralle 6 years ago.
Update @since
42108.2.diff (1.1 KB) - added by audrasjb 5 years ago.
Update @since to 5.0.3

Download all attachments as: .zip

Change History (22)

@Drivingralle
7 years ago

pass the return from wp_redirect on

#1 @Drivingralle
7 years ago

  • Keywords dev-feedback has-patch added
  • Summary changed from Pass on the returb from wp_redirect for wp_safe_redirect to Pass on the return from wp_redirect for wp_safe_redirect

#2 @joostdevalk
7 years ago

  • Component changed from Bootstrap/Load to Administration
  • Keywords early added; dev-feedback removed

Sounds good to me. Patch looks good too.

#3 @SergeyBiryukov
7 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to Future Release
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#4 @johnbillion
7 years ago

  • Milestone changed from Future Release to 5.0
  • Version changed from 4.8.2 to 2.3

#5 @johnbillion
7 years ago

  • Owner changed from SergeyBiryukov to johnbillion

#6 @johnbillion
7 years ago

In 42143:

Docs: Improve inline docs for the wp_redirect() and wp_safe_redirect() functions.

See #42505, #42108

@Drivingralle
7 years ago

Same patch. Without code style changes. Better doc block.

#7 @Drivingralle
7 years ago

At contributor day for WordCamp Cologne @ocean90 and I reviewed my earlier patch.
I modified the patch for better documentation and better readability.

#8 @johnbillion
7 years ago

  • Component changed from Administration to General

#9 @johnbillion
7 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in [42206].

#10 @Drivingralle
6 years ago

Should this be movd to 4.9.6

#11 @johnbillion
6 years ago

  • Keywords needs-patch added; has-patch early commit removed
  • Milestone changed from 5.0 to 5.0.1
  • Resolution fixed deleted
  • Status changed from closed to reopened

@since needs updating

#12 @Drivingralle
6 years ago

Uploaded a new patch.

@johnbillion did I get the update right?

#13 @pento
6 years ago

  • Milestone changed from 5.0.1 to 5.0.2

#14 @pento
6 years ago

  • Milestone changed from 5.0.2 to 5.0.3

@audrasjb
5 years ago

Update @since to 5.0.3

#15 @audrasjb
5 years ago

  • Keywords commit added

Hi, I updated @since to 5.0.3 floowing @Drivingralle 's last patch.

#16 @desrosj
5 years ago

  • Keywords commit removed
  • Milestone changed from 5.0.3 to 5.1

Let's just update the since and leave this in 5.1. @audrasjb can you say why the description was also changed in 42108.2.diff?

#17 @audrasjb
5 years ago

  • Keywords needs-refresh added

Hmm, I just updated that from trunk…

Let's add needs-refresh workflow keyword then

#18 @desrosj
5 years ago

  • Keywords needs-patch needs-refresh removed
  • Resolution set to fixed
  • Status changed from reopened to closed

This since was fixed in [44386].

Note: See TracTickets for help on using tickets.