{
  "name": "bricks/query/force_is_looping",
  "kind": "filter",
  "url": "https://academy.bricksbuilder.io/developer/hooks/filters/bricks-query-force_is_looping/",
  "scraped_at": "2026-08-29",
  "hook_name": "bricks/query/force_is_looping",
  "description": {
    "en": "Forces Bricks\\Query::is_looping() to return true . This is useful in AJAX contexts (like popups) where you need to simulate being inside a query loop to correctly render dynamic data that depends on the loop context.",
    "zh": "强制 Bricks\\Query::is_looping() 返回 true。在 AJAX 上下文（如弹窗）中很有用，在这些上下文中你需要模拟处于查询循环中以正确渲染依赖于循环上下文的动态数据。"
  },
  "parameters": [
    {
      "name": "force",
      "type": "bool",
      "type_zh": null,
      "description": {
        "en": "Whether to force the is_looping state. Default is false .",
        "zh": "是否强制 is_looping 状态。默认为 false。"
      }
    },
    {
      "name": "query_id",
      "type": "string",
      "type_zh": null,
      "description": {
        "en": "The ID of the query being checked.",
        "zh": "正在被检查的查询 ID。"
      }
    },
    {
      "name": "element_id",
      "type": "string",
      "type_zh": null,
      "description": {
        "en": "The ID of the element being checked.",
        "zh": "正在被检查的元素 ID。"
      }
    }
  ],
  "example_usage": "add_filter( 'bricks/query/force_is_looping', function( $force, $query_id, $element_id ) {\n    // Example: Force looping for a specific element ID\n    if ( $element_id === 'my_element_id' ) {\n        return true;\n    }\n\n\n    return $force;\n}, 10, 3 );"
}