Skip to content

Add full-email customization filters for login code and password reset emails - #1046

Open
AshishJii wants to merge 1 commit into
WordPress:masterfrom
AshishJii:feat/email-filters
Open

AshishJii wants to merge 1 commit into
WordPress:masterfrom
AshishJii:feat/email-filters

Conversation

@AshishJii

@AshishJii AshishJii commented Nov 17, 2026 •

Copy link
Copy Markdown

What?

Adds full-email customization filters (two_factor_email_token_email, two_factor_password_reset_email, and two_factor_admin_password_reset_email) providing to, subject, message, and headers to all remaining user-facing emails.

Fixes #1039

Why?

Previously, several transactional emails could not be fully customized:

  • Email login code mail lacked a headers filter, preventing sites from setting Content-Type: text/html.
  • Both user and admin notices had hardcoded text linking to wp-login.php, causing friction for sites with frontend account portals.

How?

  • Added two_factor_email_token_email( $email, $user, $token ) immediately before wp_mail(). Runs after existing subject and message filters.
  • Added two_factor_password_reset_email( $email, $user ) and two_factor_admin_password_reset_email( $email, $user ) when password reset.
  • Updated PHPDocs and readme.txt documenting arguments. Added unit test coverage for full customization and non-array return fallbacks.

Use of AI Tools

AI assistance: Yes
Tool(s): Google Antigravity
Model(s): Gemini
Used for: Reviewing codebase precedents, drafting initial test cases, and preparing documentation; final implementation and tests were reviewed and validated by me.

Testing Instructions

  1. Run the test suites for the affected groups:
    npm run composer -- test -- --group email
    npm run composer -- test -- --group core
  2. Verify coding standards pass:
    npm run lint:php

Changelog Entry

Added - Full-email customization filters for login code and password reset notification emails.

Open WordPress Playground Preview

@github-actions

Copy link
Copy Markdown

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 props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @37Rb.

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.

Unlinked contributors: 37Rb.

Co-authored-by: AshishJii <ashishjii@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@AshishJii
AshishJii marked this pull request as draft November 17, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add full-email customization filters for all user-facing emails

1 participant