Created
June 20, 2022 16:09
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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