Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#65427 new feature request

Add filter for WP Ability Permission Error Message

Reported by: rebasaurus Owned by:
Priority: normal Milestone: Awaiting Review
Component: General Version: 7.0
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses:

Description

WP_Ability::execute() currently replaces permission failures with a generic error message:

Ability "%s" does not have necessary permission.

For example, we enforce two-factor authentication for privileged users, but when a required 2FA check blocks an ability permission callback, the error message is very general and doesn't help the user understand why. It would be nice to be able to add a filter for the error message.

Change History (1)

This ticket was mentioned in ​PR #12111 on ​WordPress/wordpress-develop by ​@rebasaurus.


4 months ago
#1

  • Keywords has-patch has-unit-tests added

It would be nice to be able to customize the error message. Especially given that the permissions issue is dependent on 2FA.

Trac ticket: https://core.trac.wordpress.org/ticket/65427

## Use of AI Tools

AI assistance: Yes
Tool(s): Codex
Model(s): 5.5
Used for: code and tests

Note: See TracTickets for help on using tickets.