![图片[1]-Bricks 版本 1.10.2:如何通过过滤器添加额外的 HTML 标签(如 form 和 select)-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/09/20241108173952309-image.png)
releases1.10.2
Bricks 将允许的 HTML 标签限制为 WordPress 核心逻辑wp_kses_allowed_html( 'post' )
The
这导致允许使用以下现成的 HTML 标签:
address, a, abbr, acronym, area, article, aside, audio, b, bdo, big, blockquote, br, button, caption, cite, code, col, colgroup, del, dd, dfn, details, div, dl, dt, em, fieldset, figure, figcaption, font, footer, h1, h2, h3, h4, h5, h6, header, hgroup, hr, i, img, ins, kbd, label, legend, li, main, map, mark, menu, nav, object, p, pre, q, rb, rp, rt, rtc, ruby, s, samp, span, section, small, strike, strong, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, title, tr, track, tt, u, ul, ol, var, video
For example.form
默认情况下不允许在“块”元素上设置“自定义标签”,并且会在构建器中引发以下错误:
![图片[2]-Bricks 版本 1.10.2:如何通过过滤器添加额外的 HTML 标签(如 form 和 select)-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://shop.361sale.com/wp-content/uploads/2024/09/bricks-1.10.3-filter-bricks-allowed-html-tags.png)
使用如下面的代码片段所示的新过滤器,form
标签被添加到允许的 HTML 标签列表中,并且可以在没有抛出任何错误的情况下使用。
add_filter( 'bricks/allowed_html_tags', function( $allowed_html_tags ) {
// Define the additional tags to be added (e.g. 'form' & 'select')
$additional_tags = ['form', 'select'];
// Merge additional tags with the existing allowed tags
return array_merge( $allowed_html_tags, $additional_tags );
} );
Link to this article:https://www.361sale.com/en/2905The article is copyrighted and must be reproduced with attribution.
No comments