Skip to content

Instantly share code, notes, and snippets.

@richaber
Created June 20, 2022 16:09
Show Gist options
  • Save richaber/cae6dbc10b62710d18184c1c8771ac0d to your computer and use it in GitHub Desktop.
Save richaber/cae6dbc10b62710d18184c1c8771ac0d to your computer and use it in GitHub Desktop.
Admin Bar User Switching remove port number which causes issues in Local by Flywheel admin under HTTPS
<?php
/**
* Plugin Name: Admin Bar User Switching Remove Port Number From Redirect URL
* Description: Removes the port number from the Admin Bar User Switching redirect URL, as the port number causes issues in Local By Flywheel running under HTTPS.
* Version: 0.1.0
* Author: Richard Aber
* Author URI: https://richaber.com/
*/
add_filter(
'abus_switch_to_url',
function (string $url): string {
$port = parse_url($url, PHP_URL_PORT);
return ( ! empty($port))
? str_replace(':' . $port, '', $url)
: $url;
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment