[wp-trac] [WordPress Trac] #52575: get_home_path() returns "/" instead of path to WordPress directory
WordPress Trac
noreply at wordpress.org
Mon Jul 17 01:50:23 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):
@arnolp Gotcha, thanks for your patience.
I think we're all in agreement on the ticket that it's returning the
correct value within the admin for WP in it's own directory:
{{{
Home page: example.com
WP Install: example.com/wp
Path to WP: /path/to/site/wp
Expected get_home_path() result: /path/to/site
}}}
> I don't get why this code would ever work apart from admin pages
context;
As the function is located within `wp-admin/includes/file.php`, I think it
was only ever designed to work within the admin. To modify it to work on
the front-end as well would be considered an enhancement.
That may be possible using the magic constant `__DIR__` if there is the
desire to make it a front-end friendly function.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52575#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list