Fix LiteSpeed Cache fatal error when loading wp-admin file dependency #2386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow-up to #1683
Proposed changes:
require_oncestatement forwp-admin/includes/file.phpto the method whereget_home_path()is actually calledBug: The LiteSpeed Cache integration loads
wp-admin/includes/file.phpin theappend_with_markers()method, butget_home_path()is called inget_htaccess_file_path(). Whenget_htaccess_file_path()is called directly (without going throughappend_with_markers()first), the file isn't loaded, causing a fatal error.Fix: Move the
require_oncestatement fromappend_with_markers()toget_htaccess_file_path(), right beforeget_home_path()is used. This ensures the dependency is always loaded before use.Other information:
Testing instructions:
Review the code change to verify:
require_once ABSPATH . 'wp-admin/includes/file.php';statement is now inget_htaccess_file_path()whereget_home_path()is calledappend_with_markers()where it wasn't directly neededChangelog entry