[wp-trac] [WordPress Trac] #52575: get_home_path() returns "/" instead of path to WordPress directory
WordPress Trac
noreply at wordpress.org
Mon Jul 3 05:18:10 UTC 2023
#52575: get_home_path() returns "/" instead of path to WordPress directory
--------------------------------------------+------------------------------
Reporter: pixellogik | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Filesystem API | Version: 5.6.1
Severity: major | Resolution:
Keywords: reporter-feedback dev-feedback | Focuses:
--------------------------------------------+------------------------------
Comment (by peterwilsoncc):
Reviewing [https://github.com/WordPress/wordpress-
develop/blob/8fbe21a37a2649c7f0ee140d2a99fe72ca73c94e/tests/phpunit/tests/admin/includesFile.php#L9-L36
the unit tests for the function], I think `get_home_path()` is behaving as
intended for WordPress running in a sub-directory, that is a configuration
such as:
* home page: example.com/
* WP install: example.com/wp
The correct method for getting the path to the WP install is to use the
`ABSPATH` constant, `get_home_path()` looks intended to match the
directory for the URL returned by `home_url()`.
It looks like a documentation issue, the function's current docs are
certainly ambiguous as to whether it returns the path for the home page or
WP installation.
In [attachment:"52575.diff"] I've rewritten the documentation in an effort
to make it clearer that the returned path matches the path to `home_url()`
rather than to `site_url()`. Suggestions for edits are most welcome.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52575#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list