📄 原始资料 | 展开查看原始 JSON(bricks-render_popup_content-start.json){ “name”: “bricks/render_popup_content/start”, “kind”: “action”, “url”: “https://academy.bricksbuilder.io/developer/hooks/actions/bricks-render_popup_content-start/”, “scraped_at”: “2026-08-29”, “hook_name”: “bricks/render_popup…
📄 原始资料 | 展开查看原始 JSON(bricks-render_popup_content-start.json)
{
"name": "bricks/render_popup_content/start",
"kind": "action",
"url": "https://academy.bricksbuilder.io/developer/hooks/actions/bricks-render_popup_content-start/",
"scraped_at": "2026-08-29",
"hook_name": "bricks/render_popup_content/start",
"description": {
"en": "Runs at the start of the AJAX popup content rendering process ( load_popup_content endpoint). This action allows you to execute custom logic before the popup content is generated and returned.",
"zh": "在 AJAX 弹出内容渲染流程(load_popup_content 端点)开始时触发。此动作允许你在弹出内容生成并返回之前执行自定义逻辑。"
},
"parameters": [
{
"name": "request_data",
"type": "array",
"type_zh": null,
"description": {
"en": "The request data parameters (e.g., postId, popupId, etc.).",
"zh": "请求数据参数(例如 postId、popupId 等)。"
}
}
],
"example_usage": "add_action( 'bricks/render_popup_content/start', function( $request_data ) {\n // Access request data\n // $post_id = $request_data['postId'] ?? 0;\n\n\n // Example: Switch language for multilingual plugins (Polylang/WPML integration uses this)\n // if ( isset( $request_data['lang'] ) ) {\n // // Switch language logic\n // }\n} );"
}
前言
在 AJAX 弹出内容渲染流程(load_popup_content 端点)开始时触发。此动作允许你在弹出内容生成并返回之前执行自定义逻辑。
用法
将代码加入子主题的 functions.php:
add_action( 'bricks/render_popup_content/start', function( $request_data ) {
// Access request data
// $post_id = $request_data['postId'] ?? 0;
// Example: Switch language for multilingual plugins (Polylang/WPML integration uses this)
// if ( isset( $request_data['lang'] ) ) {
// // Switch language logic
// }
} );
参数
$request_data (array):请求数据参数(例如 postId、popupId 等)。
示例代码
官方示例用法
add_action( 'bricks/render_popup_content/start', function( $request_data ) {
// Access request data
// $post_id = $request_data['postId'] ?? 0;
// Example: Switch language for multilingual plugins (Polylang/WPML integration uses this)
// if ( isset( $request_data['lang'] ) ) {
// // Switch language logic
// }
} );
根据条件短路返回原值
根据条件跳过或修改返回值:
add_filter( 'bricks/render_popup_content/start', function( $value, $request_data ) {
if ( is_admin() ) { return $value; }
// TODO: custom logic here
return $value;
} );
补充说明
更多细节可参考 官方文档。