Make WordPress Core

Opened 16 months ago

Last modified 3 months ago

#60371 new defect (bug)

get_home_path fails in headless mode.

Reported by: fishpig's profile fishpig Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.4.2
Component: General Keywords:
Focuses: Cc:

Description

The core get_home_path function is incorrect when in a headless mode and siteurl and home are different.

The easy fix for this is to just add a filter to the return value so that we can return ABSPATH

Change History (1)

#1 @ruchirj
3 months ago

To call this function you need to do this.

Note that get_home_path() is declared in wp-admin/includes/file.php which is not included by default, except on admin pages when wp-admin/includes/admin.php has been included.

Ensure get_home_path() is declared.
require_once ABSPATH . 'wp-admin/includes/file.php';

$home_path = get_home_path();

Last edited 3 months ago by ruchirj (previous) (diff)
Note: See TracTickets for help on using tickets.