Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

home_url() and get_home_url() should be called with '/' argument #28

Open
siliconforks opened this issue Oct 7, 2023 · 1 comment
Open

Comments

@siliconforks
Copy link

There are a few places in the code where home_url() and get_home_url() are called without any arguments. These should be home_url( '/' ) and get_home_url( null, '/' ) respectively (or for simplicity just use home_url( '/' ) everywhere).

Calling home_url() or get_home_url() without arguments will output a URL without a trailing slash. For most WordPress sites this will not actually make any difference, but for sites where WordPress is installed in a subdirectory, the result will be a URL that looks like https://example.com/example - this will issue a 301 redirect to https://example.com/example/ instead of rendering the home page directly.

See https://github.com/Automattic/_s/blob/master/header.php for an example of using home_url( '/' ).

@jessuppi
Copy link
Member

Sounds like good info, thanks @siliconforks

Just need to hunt down these instances and make sure we don't forget any of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants