[wp-trac] [WordPress Trac] #35069: Allow short-circuiting wp_mail
WordPress Trac
noreply at wordpress.org
Sun Feb 21 19:24:30 UTC 2016
#35069: Allow short-circuiting wp_mail
--------------------------------------+------------------
Reporter: DvanKooten | Owner:
Type: enhancement | Status: new
Priority: low | Milestone: 4.5
Component: Mail | Version:
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses:
--------------------------------------+------------------
Changes (by swissspidy):
* keywords: needs-patch needs-unit-tests => has-patch has-unit-tests
Comment:
[attachment:35069.3.diff] adds a `pre_wp_mail` filter.
Passing a non-false value will short-circuit `wp_mail()`, returning that
value instead.
> When the short-circuit kicks in, it should explicitly return boolean
`false`, not `$atts`. Unless there's a reason not to?
If you're building something custom to send emails/notifications,
`wp_mail()` not returning `false` will still indicate that submission was
successful. I'm sure lots of plugins rely on the return value of
`wp_mail()` and do all sorts of stuff if it returns `false`.
Many other `pre_*` filters just return the filtered value as well, so this
adds some consistency.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35069#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list