Protect against 404s when wpBasePage is mixed case but page slug isn't #19063
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.
Overview
Partial fix for this issue on Lab.
Before
WordPress shows a 404 when
wpBasePage
is saved in mixed-case (e.g. "CiviCRM") and no CiviCRM content is rendered.After
WordPress does not show a 404 when
wpBasePage
is saved in mixed-case (e.g. "CiviCRM") and renders CiviCRM content as expected.Technical Details
WordPress requires
wpBasePage
to be lowercase or else it won't find the Base Page. If I understand how$config->wpBasePage
is read, then this PR should always force it to lowercase regardless of what is saved.This is only a partial fix because it papers over a deeper issue, which is that ideally the
$post->post_name
value that is stored inwpBasePage
should be replaced with awpBasePageID
setting that saves the$post->ID
.