📄 原始资料 | 展开查看原始 JSON(bricks_sendgrid_double_opt_in_handler.json){ “name”: “bricks_sendgrid_double_opt_in_handler”, “kind”: “action”, “url”: “https://academy.bricksbuilder.io/developer/hooks/actions/bricks-sendgrid_double_opt_in_handler/”, “scraped_at”: “2026-08-29”, “hook_name”: “bricks_…
📄 原始资料 | 展开查看原始 JSON(bricks_sendgrid_double_opt_in_handler.json)
{
"name": "bricks_sendgrid_double_opt_in_handler",
"kind": "action",
"url": "https://academy.bricksbuilder.io/developer/hooks/actions/bricks-sendgrid_double_opt_in_handler/",
"scraped_at": "2026-08-29",
"hook_name": "bricks_sendgrid_double_opt_in_handler",
"description": {
"en": "Runs before the SendGrid form action adds a new contact. Use it to trigger a custom double opt-in flow with the subscriber data Bricks collected.",
"zh": "在 SendGrid 表单动作添加新联系人之前触发。可用于使用 Bricks 收集到的订阅者数据触发自定义双重确认(double opt-in)流程。"
},
"parameters": [
{
"name": "new_subscriber_data",
"type": "array",
"type_zh": null,
"description": {
"en": "Subscriber data prepared for SendGrid, including the email address and optional first or last name.",
"zh": "为 SendGrid 准备的订阅者数据,包括电子邮件地址以及可选的姓或名。"
}
}
],
"example_usage": "add_action( 'bricks_sendgrid_double_opt_in_handler', function( $new_subscriber_data ) {\n // Send a custom double opt-in email here.\n}, 10, 1 );"
}
前言
在 SendGrid 表单动作添加新联系人之前触发。可用于使用 Bricks 收集到的订阅者数据触发自定义双重确认(double opt-in)流程。
用法
将代码加入子主题的 functions.php:
add_action( 'bricks_sendgrid_double_opt_in_handler', function( $new_subscriber_data ) {
// Send a custom double opt-in email here.
}, 10, 1 );
参数
$new_subscriber_data (array):为 SendGrid 准备的订阅者数据,包括电子邮件地址以及可选的姓或名。
示例代码
官方示例用法
add_action( 'bricks_sendgrid_double_opt_in_handler', function( $new_subscriber_data ) {
// Send a custom double opt-in email here.
}, 10, 1 );
根据条件短路返回原值
根据条件跳过或修改返回值:
add_filter( 'bricks_sendgrid_double_opt_in_handler', function( $value, $new_subscriber_data ) {
if ( is_admin() ) { return $value; }
// TODO: custom logic here
return $value;
} );
补充说明
更多细节可参考 官方文档。