Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/filter-generate-endpoint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@faustwp/wordpress-plugin": patch
---

fix[faustwp]: add `faustwp_generate_endpoint_search_pattern` filter to handle_generate_endpoint() for non-standard WordPress installations
11 changes: 11 additions & 0 deletions plugins/faustwp/includes/auth/callbacks.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@
*/
function handle_generate_endpoint() {
$search_pattern = ':^' . site_url( '/generate', 'relative' ) . ':';
/**
* Filter the search pattern used to match the generate endpoint.
*
* Useful for non-standard WordPress installations (e.g. Bedrock) where
* site_url() includes a subdirectory that does not appear in REQUEST_URI.
*
* @since 1.8.7
*
* @param string $search_pattern The regex pattern used to match the generate endpoint.
*/
$search_pattern = apply_filters( 'faustwp_generate_endpoint_search_pattern', $search_pattern );

if ( ! preg_match( $search_pattern, $_SERVER['REQUEST_URI'] ) ) { // phpcs:ignore WordPress.Security
return;
Expand Down
Loading