📄 原始资料 | 展开查看原始 JSON(bricks-get_builder_edit_link.json){ “name”: “bricks/get_builder_edit_link”, “kind”: “filter”, “url”: “https://academy.bricksbuilder.io/developer/hooks/filters/bricks-get_builder_edit_link/”, “scraped_at”: “2026-08-29”, “hook_name”: “bricks/get_builder_edit_link”, “de…
📄 原始资料 | 展开查看原始 JSON(bricks-get_builder_edit_link.json)
{
"name": "bricks/get_builder_edit_link",
"kind": "filter",
"url": "https://academy.bricksbuilder.io/developer/hooks/filters/bricks-get_builder_edit_link/",
"scraped_at": "2026-08-29",
"hook_name": "bricks/get_builder_edit_link",
"description": {
"en": "Filters the “Edit with Bricks” URL generated for a post. This allows you to append custom query parameters or modify the link structure.",
"zh": "Bricks 1.4 引入了 bricks/load_textdomain 钩子,允许你在 Bricks 加载其翻译文件后修改域。"
},
"parameters": [
{
"name": "url",
"type": "string",
"type_zh": null,
"description": {
"en": "The “Edit with Bricks” URL.",
"zh": "“使用 Bricks 编辑”的 URL。"
}
},
{
"name": "post_id",
"type": "int",
"type_zh": null,
"description": {
"en": "The ID of the post.",
"zh": "文章的 ID。"
}
}
],
"example_usage": "add_filter( 'bricks/get_builder_edit_link', function( $url, $post_id ) {\n // Example: Append a custom parameter to the builder URL\n return add_query_arg( 'my_param', 'value', $url );\n}, 10, 2 );"
}
前言
Bricks 1.4 引入了 bricks/load_textdomain 钩子,允许你在 Bricks 加载其翻译文件后修改域。
用法
将代码加入子主题的 functions.php:
add_filter( 'bricks/get_builder_edit_link', function( $url, $post_id ) {
// Example: Append a custom parameter to the builder URL
return add_query_arg( 'my_param', 'value', $url );
}, 10, 2 );
参数
$url (string):“使用 Bricks 编辑”的 URL。
$post_id (int):文章的 ID。
示例代码
筛选返回值
add_filter( 'bricks/get_builder_edit_link', function( $url, $post_id ) {
// Example: Append a custom parameter to the builder URL
return add_query_arg( 'my_param', 'value', $url );
}, 10, 2 );
根据条件短路返回原值
根据条件跳过或修改返回值:
add_filter( 'bricks/get_builder_edit_link', function( $value, $url ) {
if ( is_admin() ) { return $value; }
// TODO: custom logic here
return $value;
} );
补充说明
更多细节可参考 官方文档。