Perform feature flag change and redirection in the same request (#38833)
* Perform feature flag change and redirection in the same request * Add changelog file * Remove feature related query args after enabling/disabling it * Use REQUEST_URI instead of referred one * Fix lint errors * Move phpcs to new line * Use isset instead of empty --------- Co-authored-by: Nathan Schneider <nsschneider1@gmail.com> Co-authored-by: Lourens Schep <lourensschep@gmail.com>
This commit is contained in:
parent
ed5737ba87
commit
11541583e0
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Perform feature flag change and redirection in the same request and remove feature related query args after enabling/disabling it
|
|
@ -1152,8 +1152,9 @@ class FeaturesController {
|
|||
$query_params_to_remove[] = $feature_id;
|
||||
}
|
||||
}
|
||||
if ( count( $query_params_to_remove ) > 1 ) {
|
||||
wp_safe_redirect( remove_query_arg( $query_params_to_remove, wp_get_referer() ) );
|
||||
if ( count( $query_params_to_remove ) > 1 && isset( $_SERVER['REQUEST_URI'] ) ) {
|
||||
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
|
||||
wp_safe_redirect( remove_query_arg( $query_params_to_remove, $_SERVER['REQUEST_URI'] ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue