Make WordPress Core

Opened 2 months ago

Last modified 5 weeks ago

#60622 new enhancement

Enhancement: add filter to function get_home_path() return value

Reported by: alexrah's profile alexrah Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.4.3
Component: Administration Keywords: dev-feedback has-patch
Focuses: Cc:

Description

Allowing to filter the return value of wp-admin/includes/file.php:get_home_path() would help to handle cases when WordPress is used as an headless Rest API backend and wp_options home points to a different domain than siteurl.

In such a case, get_home_path fails to get the absolute filesystem path of the root of the WordPress installation.

Being able to filter the output of get_home_path() would allow developers to avoid breaking its functionality on headless setup.

Why is important: in a headless setup, having wp_options home set to the frontend domain allow WordPress to generate user-facing urls with the correct domain.

Change History (2)

This ticket was mentioned in PR #6171 on WordPress/wordpress-develop by alexrah.


2 months ago
#1

  • Keywords has-patch added

@alexrah commented on PR #6171:


5 weeks ago
#2

Added inline documentation for the filter as requested in src/wp-admin/includes/file.php function: get_home_path()
PS: I left the @since line uncompleted

Added Unit tests in tests/phpunit/tests/admin/includesFile.php method: test_get_home_path()

Note: See TracTickets for help on using tickets.