Add WordPress filter hook to customize or disable Permissions-Policy client hint headers
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend, documentation
Hướng nghiên cứu
Bắt đầu trong inc/admin.php tại get_permissions_policy() và add_permission_policy(), hai hàm được nêu trong issue, và lần theo nơi giá trị Permissions-Policy được truyền vào header(). Bọc mảng key/value trong apply_filters() với một tên hook đã được ghi tài liệu, và short-circuit trước khi gửi khi kết quả sau lọc là false, một chuỗi rỗng hoặc một mảng rỗng. Hoàn thành nghĩa là header có thể bị chặn hoặc thay đổi từ một theme hoặc plugin, và hook được ghi lại trong tài liệu dành cho nhà phát triển.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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)
- Ngôn ngữ chính
- PHP
- Star
- 74
- Fork
- 14
- Merge trung bình
- 1 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 39
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Codeinwp/optimole-wp
-
Page profiler never stores above-the-fold background images: `b` is always sent with empty selector mapsCó thể đã có người làm @girishpanchal30 đã nhận 9 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Codeinwp/optimole-wp#1216 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
customer report feature-request-triage
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Codeinwp/optimole-wp#1231 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug-report customer report
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
Codeinwp/optimole-wp#1211 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
customer report feature-request-triage
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Codeinwp/optimole-wp#1179 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add setting to disable Optimole URL rewriting for social meta tags (og:image / twitter:image)Đang mởcustomer report feature-request-triage
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
Codeinwp/optimole-wp#1178 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Codeinwp/optimole-wp
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
claude
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
sprain/sprainocchio#38 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Перевод устарел
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày