site_url() vs home_url()
-
Hi there,
I am using Bedrock (roots.io) and I noticed a little issue. In the method:
#Classes/Events/SendHeadersEvent.php:106
private function progressTestsForRedirect($clientId)
you’re using the
site_url()
function and it is returning https://www.example.com/wp
The wp suffix prevents the str_replace and the sql query is failing. I was able to fix it usinghome_url()
instead ofsite_url()
$urlBase = home_url(); $requestUrl = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $relativePath = str_replace($urlBase, "", $requestUrl); $relativePath = explode("?", $relativePath)[0]; $relativePath = trim($relativePath, "/");
Do you think it is possible to correct your code using home_url()?
Regards
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘site_url() vs home_url()’ is closed to new replies.