📄 原始资料 | 展开查看原始 JSON(bricks-metabox-taxonomy-show_as_link.json){ “name”: “bricks/metabox/taxonomy/show_as_link”, “kind”: “filter”, “url”: “https://academy.bricksbuilder.io/developer/hooks/filters/bricks-metabox-taxonomy-show_as_link/”, “scraped_at”: “2026-08-29”, “hook_name”: “bricks/met…
📄 原始资料 | 展开查看原始 JSON(bricks-metabox-taxonomy-show_as_link.json)
{
"name": "bricks/metabox/taxonomy/show_as_link",
"kind": "filter",
"url": "https://academy.bricksbuilder.io/developer/hooks/filters/bricks-metabox-taxonomy-show_as_link/",
"scraped_at": "2026-08-29",
"hook_name": "bricks/metabox/taxonomy/show_as_link",
"description": {
"en": "Determines whether Meta Box taxonomy fields retrieved via dynamic data should be rendered as links to the term archives.",
"zh": "使用此筛选器可在 Bricks 中添加或修改面包屑设置。"
},
"parameters": [
{
"name": "show_as_link",
"type": "bool",
"type_zh": null,
"description": {
"en": "Whether to render as links. Default is true .",
"zh": "是否渲染为链接。默认为 true。"
}
},
{
"name": "value",
"type": "mixed",
"type_zh": null,
"description": {
"en": "The raw value of the taxonomy field.",
"zh": "分类法字段的原始值。"
}
},
{
"name": "field",
"type": "array",
"type_zh": null,
"description": {
"en": "The Meta Box field settings array.",
"zh": "Meta Box 字段设置数组。"
}
}
],
"example_usage": "add_filter( 'bricks/metabox/taxonomy/show_as_link', function( $show_as_link, $value, $field ) {\n // Disable links for a specific taxonomy field\n if ( $field['id'] === 'my_taxonomy_field' ) {\n return false;\n }\n\n\n return $show_as_link;\n}, 10, 3 );"
}
前言
使用此筛选器可在 Bricks 中添加或修改面包屑设置。
用法
将代码加入子主题的 functions.php:
add_filter( 'bricks/metabox/taxonomy/show_as_link', function( $show_as_link, $value, $field ) {
// Disable links for a specific taxonomy field
if ( $field['id'] === 'my_taxonomy_field' ) {
return false;
}
return $show_as_link;
}, 10, 3 );
参数
$show_as_link (bool):是否渲染为链接。默认为 true。
$value (mixed):分类法字段的原始值。
$field (array):Meta Box 字段设置数组。
示例代码
筛选返回值
add_filter( 'bricks/metabox/taxonomy/show_as_link', function( $show_as_link, $value, $field ) {
// Disable links for a specific taxonomy field
if ( $field['id'] === 'my_taxonomy_field' ) {
return false;
}
return $show_as_link;
}, 10, 3 );
根据条件短路返回原值
根据条件跳过或修改返回值:
add_filter( 'bricks/metabox/taxonomy/show_as_link', function( $value, $show_as_link ) {
if ( is_admin() ) { return $value; }
// TODO: custom logic here
return $value;
} );
补充说明
更多细节可参考 官方文档。