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