(Dirty) fix for wp_cli errors (PHP 8.3)
-
For those who get a lot of these:
Warning: Undefined array key "HTTP_HOST" in /REDACTED/wp-content/plugins/quick-pagepost-redirect-plugin/page_post_redirect_plugin.php on line 2053 Warning: Undefined array key "HTTP_HOST" in /REDACTED/wp-content/plugins/quick-pagepost-redirect-plugin/page_post_redirect_plugin.php on line 2061
Here’s a quick and dirty fix:- Goto Plugins > Plugin File Editor
- Select Plugin To Edit
- Replace function getAddress and function getQAddress with the following code:
function getAddress($home = ''){
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
$https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : '';
$protocol = $https !== '' && strpos($home, 'http:') === false ? 'https' : 'http';
return $protocol . '://' . $host . $_SERVER['REQUEST_URI'];
}
function getQAddress($home = ''){
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
$https = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : '';
$protocol = $https !== '' && strpos($home, 'http:') === false ? 'https' : 'http';
return $protocol . '://' . $host;
}
The topic ‘(Dirty) fix for wp_cli errors (PHP 8.3)’ is closed to new replies.