Middleware for snicco/http-routing
to only allow access to guest WordPress users.
composer require snicco/wp-guest-only-middleware
This middleware should be added on a per-route basis.
If a logged a user is logged in this middleware will try to redirect to a route named dashbaord
if it exists.
Otherwise, the user is redirect to the homepage.
Optionally, a custom redirect path can be set by passing middleware arguments.
// Assumes you have configured an alias for "guests-only" => WPGuestsOnly::class
// A logged-in user will now be redirected to /foo.
$configurator->get('route1', '/route1', SomeController::class)
->middleware('guests-only:/foo');
This repository is a read-only split of the development repo of the Snicco project.
This is how you can contribute.
Please report issues in the Snicco monorepo.
If you discover a security vulnerability, please follow our disclosure procedure.