Make WordPress Core

Opened 2 years ago

Last modified 8 weeks 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
12 months ago

To call this function you neew 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();

Version 0, edited 12 months ago by ruchirj (next)
Note: See TracTickets for help on using tickets.