{
  "name": "bricks/database/get_all_templates_cache_key",
  "kind": "filter",
  "url": "https://academy.bricksbuilder.io/developer/hooks/filters/bricks-database-get_all_templates_cache_key/",
  "scraped_at": "2026-08-29",
  "hook_name": "bricks/database/get_all_templates_cache_key",
  "description": {
    "en": "Filters the cache key used to store and retrieve the list of all Bricks templates. This allows plugins to create unique cache entries based on context (e.g., current language).",
    "zh": "Bricks 默认使用 WordPress 默认的数据视图（dataview）。在创建新元素时，你可以使用此筛选器启用 Bricks 的增强数据视图。增强数据视图提供更多可自定义选项，并支持通过钩子添加新选项卡（如 WooCommerce）。"
  },
  "parameters": [
    {
      "name": "cache_key",
      "type": "string",
      "type_zh": null,
      "description": {
        "en": "The default cache key (e.g., all_templates_{timestamp} ).",
        "zh": "默认缓存键（例如 all_templates_{timestamp}）。"
      }
    }
  ],
  "example_usage": "add_filter( 'bricks/database/get_all_templates_cache_key', function( $cache_key ) {\n    // Example: Append current language code to cache key\n    if ( defined( 'ICL_LANGUAGE_CODE' ) ) {\n        $cache_key .= '_' . ICL_LANGUAGE_CODE;\n    }\n\n\n    return $cache_key;\n} );"
}