fix misleading notice #855#858
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @christofervas. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
@masteradhoc The dynamic check on the warning notice is the right approach, but as I noted on the issue, there's a second hard-coded "Recovery Codes" mention at Happy to push a commit to your branch if you'd like. Here's what the second fix would look like: <?php
if ( isset( $providers['Two_Factor_Backup_Codes'] ) ) {
esc_html_e( 'Configure a primary two-factor method along with an additional authentication method to avoid being locked out if you lose access to your primary method. Methods marked as recommended are more secure and easier to use.', 'two-factor' );
} else {
esc_html_e( 'Configure a primary two-factor method along with an additional authentication method to avoid being locked out if you lose access to your primary method. Methods marked as recommended are more secure and easier to use.', 'two-factor' );
}
?>And a minor suggestion — the message could be simplified like this: __( 'To prevent being locked out of your account, consider enabling an additional authentication method in case you lose access to your primary authentication method.', 'two-factor' )To make it absolutely clear this is a "secondary" or "additional" authentication method, those terms are better than "backup method," which could be misunderstood as referring to a system backup. Also, the "methods marked as recommended" text seems to add a vague and not directly relevant suggestion. The user can see clearly enough what methods are marked as recommended. |
|
Thanks @dknauss!
I'd also prefer to avoid changing strings unnecessarily — every modification invalidates existing translations across all locales. |
|
I tested the latest commit in Studio, and the second notice is now handled too. It works as expected and reads fine for me! Not a blocker, but the missing test coverage would be nice to include, so I went ahead and did that here:
This branch adds coverage in
Tested locally with Studio, wp-env, Codex, and Claude. |
|
Thanks @dknauss i just added your work to this PR. Appreciate you taking a look at this again :) |

What?
Show a generic fallback notice when the
Two_Factor_Backup_Codesprovider has been removed via thetwo_factor_providersfilter, instead of always referencing "Recovery Codes" regardless of whether that provider is available.Why?
When sites use the
two_factor_providersfilter to removeTwo_Factor_Backup_Codes, the notice still tells users to enable "Recovery Codes" — a method that doesn't exist in their setup. This is misleading and confusing.Fixes #855.
How?
The existing condition already correctly uses the filtered
$providersarray to determine whether there are multiple providers available (count( $providers ) > 1). The fix adds a simpleisset( $providers['Two_Factor_Backup_Codes'] )check on the message string itself:Two_Factor_Backup_Codesis present → show the existing specific message referencing Recovery Codes.Two_Factor_Backup_Codesis absent → show a generic message encouraging the user to enable any additional method.No new filters or structural changes are needed.
Testing Instructions
functions.phpor a mu-plugin:Changelog Entry