Add WordPress filter hook to customize or disable Permissions-Policy client hint headers
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 领域
- backend, documentation
调研方向
从 inc/admin.php 中的 get_permissions_policy() 和 add_permission_policy() 开始,这两个函数在 issue 中被点名,并追踪 Permissions-Policy 的值在哪里被传给 header()。用有文档记录的 hook 名称将键/值数组包在 apply_filters() 中,并在过滤后的结果为 false、空字符串或空数组时,在发送前短路。完成意味着该 header 可以从主题或插件中被抑制或修改,并且该 hook 已写入开发者文档。
由索引模型根据 Issue 内容生成。
描述
Impact: 60 · Confidence: 95 · Complexity: 20
Description
Problem
The Optimole WordPress plugin automatically emits a Permissions-Policy: ch-viewport-width=(self ...) header in inc/admin.php to enable Client Hints / Smart Image Scaling. However, there is currently no WordPress filter hook wrapping this response header. Site administrators who want to remove or customize the header (for example, to prevent low-resolution image selection on cached pages or mobile viewports where text density is critical) must write custom code to strip headers late in execution, which is fragile and prone to breaking during plugin updates.
Desired Behavior
Expose a WordPress filter hook (e.g. optimole_permissions_policy_header or optml_permissions_policy) allowing developers to filter the header key/value array or disable the Permissions-Policy header completely before it is sent via header().
Acceptance Criteria
- Introduce a WordPress filter hook surrounding the generation/output of the
Permissions-Policyheader ininc/admin.php. - Returning
false, an empty string, or an empty array from the filter suppresses the header from being sent. - Document the filter hook for site developers in technical/developer docs.
Customer Context
John Green (Founder & CEO at Fighting Arts Health Lab, starter-2 paid subscriber) observed that client hints were sending smaller 414px images to mobile viewports, which rendered text inside card images visibly soft/blurry on high-density mobile screens. To fix this, his team decided to strip the ch-viewport-width Permissions-Policy header. Because Optimole currently has no filter hook on get_permissions_policy() / add_permission_policy() in inc/admin.php, they were forced to strip the header with custom code after Optimole sends it. He requested a supported filter or setting so custom header modifications won't break on plugin updates.
Root Cause Analysis
The customer's underlying goal is to control whether Optimole sends the Permissions-Policy Client Hint header without having to write fragile post-header removal scripts. Optimole's inc/admin.php sends hardcoded header directives without passing them through WordPress apply_filters(). Providing a developer filter hook directly addresses this capability gap in a standard WordPress-idiomatic way.
Source: HelpScout #3513913699
Generated by feature-request-triage workflow (ID: feature-request-triage_6af9bb9d556245.38695477)
- 主要语言
- PHP
- 星标
- 74
- 派生
- 14
- 平均合并
- 1 天 20 小时
- 30 天内合并 PR
- 39
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Codeinwp/optimole-wp 的其他 Issue
-
Page profiler never stores above-the-fold background images: `b` is always sent with empty selector maps可能已有人在做 @girishpanchal30 于 9 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 77/100
Codeinwp/optimole-wp#1216 · 已指派 1 人 ·
维护者通常 1 天内回复
-
customer report feature-request-triage
难度 5/5 一周以上 新手友好度 35/100
Codeinwp/optimole-wp#1231 ·
维护者通常 1 天内回复
-
bug-report customer report
难度 4/5 3-5 天 新手友好度 56/100
Codeinwp/optimole-wp#1211 ·
维护者通常 1 天内回复
-
customer report feature-request-triage
难度 5/5 一周以上 新手友好度 35/100
Codeinwp/optimole-wp#1179 ·
维护者通常 1 天内回复
-
customer report feature-request-triage
难度 4/5 3-5 天 新手友好度 54/100
Codeinwp/optimole-wp#1178 ·
维护者通常 1 天内回复
查看 Codeinwp/optimole-wp 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
claude
难度 2/5 1-3 小时 新手友好度 74/100
sprain/sprainocchio#38 ·
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复