-
-
Notifications
You must be signed in to change notification settings - Fork 495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sniff to check that WP is killed after wp_(safe_)redirect #1205
Comments
Some thoughts: The call to if ( $redirect_to ) {
wp_safe_redirect( add_query_arg( $args, $redirect_to ) );
} elseif ( ! current_user_can( 'read' ) ) {
wp_safe_redirect( add_query_arg( $args, home_url() ) );
} else {
wp_safe_redirect( add_query_arg( $args, admin_url() ) );
}
exit; I don't think there's any reason to allow |
I think |
Interesting point! With that in mind, are redirects always guaranteed to work if there's HTML output after the location header? I guess they are, but I'm not sure. |
Using Calling |
|
@lkraav This is the repo for the WordPress Coding Standards. Not for |
@johnbillion's Nov 2017 analysis of the situation #1205 (comment) might be the most authoritative piece on the subject right now, though, and was super useful. It's 18 months later now, so my comment's idea was to ping the crew here if perhaps new knowledge has emerged in the meanwhile, but simply hasn't been written up. |
I was looking to write a sniff to enforce the conditional wrapping of The In cases where The other suggested way to structure My particular use case is on
This code in pluggable.php:1349 cannot be relied upon to work without a sniff enforcing the conditional style:
|
Add sniff to check that any call to
wp_redirect()
andwp_safe_redirect()
is followed by a call todie()
,exit
orwp_die()
.The call is allowed to be conditional.
Refs:
Reminder: if/when this sniff is pulled, the error message for
WordPress.VIP.RestrictedFunctions.wp_redirect_wp_redirect
can be shortened to avoid message duplication.Suggestions for additional functions which should be checked for this welcome!
The text was updated successfully, but these errors were encountered: