Support

Winden in Subfolder – Blank Admin Page

Publish date: 05/07/2024 •  Bug • Winden •  Christopher Nonne

Hi,

seems like the CSS & JS in the admin screen don’t get the right WP-Content path.

I have wordpress in a subfolder and the admin screen keeps blank because 2 resources don’t load correct. To me the error lies within the CoreHelper Class.

You can fix this by editing the getWpContentPath() function in the CoreHelper.php:

public static function getWpContentPath()
    {
        $wpContentDir = realpath(WP_CONTENT_DIR);
        $documentRoot = realpath($_SERVER[‘DOCUMENT_ROOT’]);

        if ($wpContentDir && $documentRoot) {
            // Ensure we get the relative path from the document root
            $relativePath = str_replace($documentRoot, ”, $wpContentDir);
            return trim($relativePath, DIRECTORY_SEPARATOR);
        } else {
            // Fallback to default scanning method
            $data = self::list_wp_directories(”, ABSPATH, ‘wp-content’);
            if (count($data)) {
                $datum = self::getItemByName($data, ‘wp-content’);
                if (isset($datum[‘path’])) {
                    return $datum[‘path’];
                }
            }
        }

        return ‘wp-content’; // Default fallback
    }

Uploaded files:

Leave a Reply