Automattic\WooCommerce\Admin
PluginsInstaller::redirect_to_referer
Redirect back to the referring page if one exists.
Method of the class: PluginsInstaller{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = PluginsInstaller::redirect_to_referer();
PluginsInstaller::redirect_to_referer() PluginsInstaller::redirect to referer code WC 10.7.0
public static function redirect_to_referer() {
$referer = wp_get_referer();
if ( $referer && 0 !== strpos( $referer, wp_login_url() ) ) {
wp_safe_redirect( $referer );
exit();
}
if ( ! isset( $_SERVER['REQUEST_URI'] ) ) {
return;
}
$url = remove_query_arg( 'plugin_action', wp_unslash( $_SERVER['REQUEST_URI'] ) ); // phpcs:ignore sanitization ok.
$url = remove_query_arg( 'plugins', $url );
wp_safe_redirect( $url );
exit();
}