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

Fix to work when wordpress installed in its own subdirectory #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

martignoni
Copy link

Function site_url doesn't work when WP is installed in a subdirectory.

@martignoni
Copy link
Author

Unfortunately, this does not work as described :-( Closing, and sorry for the spam. Hopefully a solution can be found for my situation, though.

@martignoni martignoni closed this Dec 3, 2016
@martignoni
Copy link
Author

Re-tested. Proposed fix indeed works. Reopening. Sorry for the spam.

@martignoni martignoni reopened this Dec 4, 2016
@bjoerne2
Copy link
Owner

bjoerne2 commented Mar 7, 2017

@martignoni You replace site_url with home_url. According the docs https://codex.wordpress.org/Function_Reference/site_url site_url seems the correct one when WP is installed in a directory.
But maybe in your case home_url makes sense. Could you describe your use case and why you need the change?

@martignoni
Copy link
Author

@bjoerne2 I use this guide https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory (method I, using same URL). The whole idea is to install WP into a subdirectory, but have the website served from the website root.

Without replacing site_url with home_url, your plugin fails in this case, since it returns the Site directory URL (eg. http://www.example.com/wp), instead of the Home URL (eg. http://www.example.com), as indicated in the docs you cite (https://codex.wordpress.org/Function_Reference/site_url).

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

Successfully merging this pull request may close these issues.

2 participants