admin管理员组文章数量:1431420
I'm looking for a way to hook into the mail function before it sends so I can var_dump the output. Are there any action hooks with the mail message that I can hook into? I'm having trouble finding the wp_mail()
function in core. Any other methods of debugging mail output would be greatly appreciated as well.
I'm looking for a way to hook into the mail function before it sends so I can var_dump the output. Are there any action hooks with the mail message that I can hook into? I'm having trouble finding the wp_mail()
function in core. Any other methods of debugging mail output would be greatly appreciated as well.
1 Answer
Reset to default 4The first link on Google is to https://developer.wordpress/reference/functions/wp_mail/ which says that wp_mail is in wp-includes/pluggable.php
It also has the full function source code showing that the first active line of the function is:
$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
... which suggests that if you hook into the filter you can capture all of those fields.
Additionally as it's a pluggable function you could also replace it with your own function doing whatever you want with the messages.
本文标签: debugIntercepting wpmail() to view contents
版权声明:本文标题:debug - Intercepting wp_mail() to view contents 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745571834a2664093.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论