{
  "name": "bricks/code/echo_function_names",
  "kind": "filter",
  "url": "https://academy.bricksbuilder.io/developer/hooks/filters/filter-bricks-code-echo_function_names/",
  "scraped_at": "2026-08-29",
  "hook_name": "bricks/code/echo_function_names",
  "description": {
    "en": "Note",
    "zh": "注意"
  },
  "example_usage": null,
  "additional_sections": [
    {
      "heading": {
        "en": "Using patterns (regex) to simplify echo function calls",
        "zh": "使用正则模式（regex）简化 echo 函数调用"
      },
      "content": {
        "en": "Bricks 1.9.8 offers greater flexibility when it comes to echo function calls.\nWhile you can still return an array with the exact function names, you can also return an array that contains specific regex checks. We identify those regex calls by the\n@\nprefix.\nIf your function name matches any of those regex checks, it can be called through the\necho\ntag.\nExample: Allow calling any functions that start with\nbrx_\n:",
        "zh": "Bricks 1.9.8 在 echo 函数调用方面提供了更大的灵活性。虽然你仍然可以返回包含确切函数名称的数组，但你也可以返回包含特定正则检查的数组。我们通过 @ 前缀来标识这些正则调用。如果你的函数名称与这些正则检查中的任何一个匹配，就可以通过 echo 标签调用它。\n\n示例：允许调用任何以 brx_ 开头的函数："
      }
    },
    {
      "heading": {
        "en": "Check function names against your own custom logic",
        "zh": "根据自定义逻辑检查函数名称"
      },
      "content": {
        "en": "Instead of returning an array, you can also perform any custom check against the function name itself or any other logic you want to run. The filter receives the function name (\n$function_name\n) as an argument to assist in making more dynamic decisions. Returning a boolean (\ntrue\nor\nfalse\n)\nExample: Allow function execution based on function name prefix\nThis example uses a straightforward check to determine if the function starts with\ncustom_\n. If so, it returns\ntrue\n, allowing the function to be executed; otherwise, it returns\nfalse\n.\nExample: Run any function when development mode is enabled\nThe\nWP_DEVELOPMENT_MODE\nPHP constant has been available in WordPress core since version 6.3. We use it just as an example. You can use any custom PHP constant of your choice by defining it in your child theme’s functions.php file.\nExample: Run function if the current user can edit posts",
        "zh": "除了返回数组之外，你还可以对函数名称本身或要运行的任何其他自定义逻辑执行自定义检查。该筛选器接收函数名称（$function_name）作为参数，以帮助做出更动态的决策。返回布尔值（true 或 false）。\n\n示例：根据函数名称前缀允许执行函数\n\n此示例使用直接检查来确定函数是否以 custom_ 开头。如果是，则返回 true，允许执行该函数；否则返回 false。\n\n示例：在启用开发模式时运行任何函数\n\nWP_DEVELOPMENT_MODE PHP 常量自 WordPress 核心 6.3 版起可用。我们仅以此为例。你可以通过在子主题的 functions.php 文件中定义来使用任何自定义 PHP 常量。\n\n示例：如果当前用户可以编辑文章则运行函数"
      }
    }
  ]
}