Add WordPress filter hook to customize or disable Permissions-Policy client hint headers
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend, documentation
Research direction
Start in inc/admin.php at get_permissions_policy() and add_permission_policy(), the two functions named in the issue, and trace where the Permissions-Policy value is passed to header(). Wrap the key/value array in apply_filters() with a documented hook name, and short-circuit before sending when the filtered result is false, an empty string or an empty array. Done means the header can be suppressed or altered from a theme or plugin, and the hook is written up in the developer docs.
Written by the indexing model from the issue text.
Description
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)
- Dominant language
- PHP
- Stars
- 74
- Forks
- 14
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 39
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Codeinwp/optimole-wp
-
Page profiler never stores above-the-fold background images: `b` is always sent with empty selector mapsPossibly taken @girishpanchal30 claimed this 9 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Codeinwp/optimole-wp#1216 · 1 assignee ·
Maintainers usually reply within 1 day
-
customer report feature-request-triage
Difficulty 5/5 Over a week Newbie friendliness 35/100
Codeinwp/optimole-wp#1231 ·
Maintainers usually reply within 1 day
-
bug-report customer report
Difficulty 4/5 3-5 days Newbie friendliness 56/100
Codeinwp/optimole-wp#1211 ·
Maintainers usually reply within 1 day
-
customer report feature-request-triage
Difficulty 5/5 Over a week Newbie friendliness 35/100
Codeinwp/optimole-wp#1179 ·
Maintainers usually reply within 1 day
-
customer report feature-request-triage
Difficulty 4/5 3-5 days Newbie friendliness 54/100
Codeinwp/optimole-wp#1178 ·
Maintainers usually reply within 1 day
All issues in Codeinwp/optimole-wp
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
claude
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
sprain/sprainocchio#38 ·
Maintainers usually reply within 1 day
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Перевод устарел
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day