{
  "name": "bricks/element/maybe_set_aria_current_page",
  "kind": "filter",
  "url": "https://academy.bricksbuilder.io/developer/hooks/filters/bricks-element-maybe_set_aria_current_page/",
  "scraped_at": "2026-08-29",
  "hook_name": "bricks/element/maybe_set_aria_current_page",
  "description": {
    "en": "Filters the boolean value that determines whether to add the aria-current=\"page\" attribute to a link element. This is used to indicate that a link points to the currently active page.",
    "zh": "使用此筛选器可在 Bricks 元素库中修改元素的默认设置。"
  },
  "parameters": [
    {
      "name": "set_aria_current",
      "type": "bool",
      "type_zh": null,
      "description": {
        "en": "Whether the link matches the current page.",
        "zh": "链接是否匹配当前页面。"
      }
    },
    {
      "name": "url",
      "type": "string",
      "type_zh": null,
      "description": {
        "en": "The URL of the link being checked.",
        "zh": "正在被检查的链接 URL。"
      }
    }
  ],
  "example_usage": "add_filter( 'bricks/element/maybe_set_aria_current_page', function( $set_aria_current, $url ) {\n    // Example: Consider a link active if it matches a specific query parameter\n    if ( isset( $_GET['section'] ) && strpos( $url, 'section=' . $_GET['section'] ) !== false ) {\n        return true;\n    }\n\n\n    return $set_aria_current;\n}, 10, 2 );"
}