你关于应该如何构造插件的问题有点过于宽泛,但下面是标题问题的具体答案。
要在发送邮件头之前更改邮件头,请使用wp_headers
滤器
function tsg_filter_headers( $headers )
{
// For debug. This will break your page but you will see which headers are sent
// print_r( $headers );
// It’s a good idea to leave the admin alone
if ( !is_admin() ) {
// Add or redefine \'Content-Location\' header
$headers[\'Content-Location\'] = \'/my-receipts/42\';
}
return $headers;
}
add_filter( \'wp_headers\', \'tsg_filter_headers\' );
查看WordPress文档
here.