diff --git a/.changeset/filter-generate-endpoint.md b/.changeset/filter-generate-endpoint.md new file mode 100644 index 000000000..830cb9a56 --- /dev/null +++ b/.changeset/filter-generate-endpoint.md @@ -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 diff --git a/plugins/faustwp/includes/auth/callbacks.php b/plugins/faustwp/includes/auth/callbacks.php index da82180d0..10c5dbe02 100644 --- a/plugins/faustwp/includes/auth/callbacks.php +++ b/plugins/faustwp/includes/auth/callbacks.php @@ -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;