fix[faustwp]: (#1872) add filter for search_pattern in handle_generate_endpoint#2315
Open
latenighthackathon wants to merge 1 commit intowpengine:canaryfrom
Open
Conversation
…_generate_endpoint Add apply_filters( 'faustwp_generate_endpoint_search_pattern' ) so non-standard WordPress installations like Bedrock can customize the regex pattern used to match the /generate endpoint. Bedrock returns /wp/generate from site_url() but REQUEST_URI only contains /generate, causing the preg_match to fail and previews to 404. The filter lets users adjust the pattern without modifying the plugin source. Closes wpengine#1872
|
Currently, we do not support the creation of preview deployments based on changes coming from forked repositories. |
🦋 Changeset detectedLatest commit: 8c27dce The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Non-standard WordPress installations like Bedrock use a different directory structure where
site_url()returns a path with a/wp/prefix (e.g./wp/generate) but$_SERVER['REQUEST_URI']contains only/generate. This causes thepreg_matchinhandle_generate_endpoint()to fail, resulting in 404 errors when previewing content.This PR adds an
apply_filters()call on$search_patternso sites with non-standard directory structures can adjust the matching pattern without modifying the plugin source.Usage example for Bedrock:
Related Issues
Closes #1872
Testing
Confirm the issue (before the fix)
1. Verify no filter exists on
$search_pattern:2. Verify
$search_patternusessite_url()which includes subdirectories on Bedrock:Confirm the fix
3. Verify the filter is applied after
$search_patternis constructed:4. Verify the docblock follows WordPress standards (@SInCE, @param):
Run the test suites
phpcs — confirms the filter follows WordPress coding standards:
JS tests — confirms no regressions:
WordPress PHPUnit — confirms plugin functionality: