Automattic / Automattic/maintenance-mode-wp

Required capability: Redirect to maintenance mode page on login

Open
#30 0 comments 0 reactions 0 assignees View on GitHub
type: enhancement
Dominant language
PHP
Stars
50
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Currently, we have the `vip_maintenance_mode_required_cap` filter that check's for a required capability (`edit_posts` by default) and if the user does NOT have that capability, it will redirect them to the Maintenance Mode page.

However, this is hooked into `template_redirect` so it only happens on the frontend of the site. If they log in they will still be redirected to the Dashboard. If they try to view the site, they will see the Maintenance Mode page.

I think it makes sense to redirect everywhere and not just on the frontend.

Possible use case:
I am a site Admin and I want to enable maintenance mode and restrict specific users from logging in. I add a filter to restrict all non-admins from being able to log in, and I do some maintenance tasks while confidently knowing no one else is logging in to update/change data.

Thoughts?
cc @anigeluk

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the vip_maintenance_mode_required_cap filter and its template_redirect hook, then trace the login flow that currently sends users to the Dashboard. Confirm how capability checks and the Maintenance Mode page interact, and consider the existing behavior complete when users without the required capability are redirected during login as well as on the frontend.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication, backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.