I’m using the whole pack: trellis, bedrock, and sage. I’m just wondering why, when I call site_url() I get mydomain.dev/wp url when nowhere else I see or use the /wp path in my url. Does something break if I change the site_url constant in the .env file? Should I just use get_home_url() ?
Yes. The site URL will always return
Reviving an old thread because it might help someone else.
We recently converted an existing project from standard structure of bedrock on our production server. During launch we discovered breaking bugs where URLs to content and images were being rewritten from
We eventually located the issue to a filter on the_content that we wrote years ago. It ran a regex search on old versions of our client’s domain name (“our-domain.org”) and replaced with
site_url. Because the wp options
home_url are generally identical on standard WordPress sites this didn’t cause an issue until we migrated to bedrock.
It was really an issue of bad coding on our part. The solution is to never use
site_url unless you really mean to use the file path and not the base URL. Using
home_url is generally the best practice.