diff --git a/.changeset/tasty-walls-thank.md b/.changeset/tasty-walls-thank.md new file mode 100644 index 000000000..a988baa93 --- /dev/null +++ b/.changeset/tasty-walls-thank.md @@ -0,0 +1,5 @@ +--- +'@faustwp/wordpress-plugin': minor +--- + +Added new filter `faustwp_public_redirect_status_code`, allowing WordPress plugins and themes to choose the [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status) to use when generating redirects when the [enable public route redirects](https://faustjs.org/docs/faustwp/settings#enabling-public-route-redirects) setting is active. diff --git a/plugins/faustwp/includes/deny-public-access/callbacks.php b/plugins/faustwp/includes/deny-public-access/callbacks.php index 052dca2a2..c5eac2c6d 100644 --- a/plugins/faustwp/includes/deny-public-access/callbacks.php +++ b/plugins/faustwp/includes/deny-public-access/callbacks.php @@ -60,7 +60,7 @@ function deny_public_access() { // Get the request uri with query params. $request_uri = home_url( add_query_arg( null, null ) ); - $response_code = 302; + $response_code = apply_filters( 'faustwp_public_redirect_status_code', 302 ); $redirect_url = str_replace( trailingslashit( get_home_url() ), $frontend_uri, $request_uri ); $protocols = array( 'http', 'https' );