fix(uninstall): remove two_factor_enabled_providers option on uninstall#903
Open
faisalahammad wants to merge 1 commit into
Open
fix(uninstall): remove two_factor_enabled_providers option on uninstall#903faisalahammad wants to merge 1 commit into
faisalahammad wants to merge 1 commit into
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 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. |
kasparsd
reviewed
Jun 11, 2026
The site-wide enabled providers option added in 0.16 was not included in Two_Factor_Core::uninstall(), so it was left behind in wp_options after uninstalling the plugin. Add a class constant for the option key and include it in the uninstall list. Replace the literal in the main file and settings UI to use the constant. Fixes WordPress#902
179704f to
60628e8
Compare
Author
|
Done. Removed Diff: https://github.com/WordPress/two-factor/pull/903/files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
two_factor_enabled_providersoption (added in 0.16) was not being removed when the plugin is uninstalled, leaving an orphaned row inwp_options. This fix adds the option to the uninstall list and centralises the key in a class constant.Fixes #902
Changes
class-two-factor-core.phpBefore:
After:
Why: Mirrors the existing pattern of constants-on-the-class for every other plugin meta/option key and adds the missing option to the uninstall list.
two-factor.phpandsettings/class-two-factor-settings.phpReplaced the literal
'two_factor_enabled_providers'withTwo_Factor_Core::ENABLED_PROVIDERS_OPTION_KEYso the key lives in one place.tests/class-two-factor-core.phpAdded
test_uninstall_removes_enabled_providers_optionto cover the new cleanup path.Testing
Test 1: Automated
npm testnpm run composer -- test -- --filter test_uninstallResult: 185/185 pass (6 uninstall tests pass, including the new one).
Test 2: Manual
wp_options: notwo_factor_enabled_providersrow.