You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何为ACF Block启用全部区块支持功能?

为ACF自定义区块启用所有核心编辑器支持功能

WordPress区块系统并没有提供一键启用所有核心编辑器支持的选项,你需要手动在supports字段中列出所有核心支持的功能并设置为启用状态。

以下是修改后的完整block.json配置,已包含所有核心编辑器支持项:

{
    "name": "acf/testimonial",
    "title": "Testimonial",
    "description": "A custom testimonial block.",
    "style": [ "file:./testimonial.css" ],
    "category": "formatting",
    "icon": "admin-comments",
    "keywords": ["testimonial", "quote"],
    "acf": {
        "mode": "preview",
        "renderTemplate": "testimonial.php"
    },
    "supports": {
        "align": true,
        "alignContent": true,
        "alignText": true,
        "anchor": true,
        "border": true,
        "className": true,
        "color": {
            "text": true,
            "background": true,
            "gradient": true
        },
        "customClassName": true,
        "defaultStylePicker": true,
        "html": true,
        "multiple": true,
        "reusable": true,
        "spacing": {
            "padding": true,
            "margin": true,
            "blockGap": true
        },
        "typography": {
            "fontSize": true,
            "lineHeight": true,
            "fontWeight": true,
            "fontStyle": true,
            "textTransform": true,
            "textDecoration": true,
            "letterSpacing": true,
            "fontFamily": true
        },
        "wideAlignment": true
    }
}

配置说明

  • 部分支持项(如color、spacing)采用了展开式配置,确保启用该分类下的所有子功能
  • 如果不需要某项功能,直接将对应字段设为false或删除即可
  • 若ACF预览模式导致部分编辑器功能异常,可尝试将acf.mode改为edit测试

内容的提问来源于stack exchange,提问作者JgNewDev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 14:25:09