Yoast / Yoast/duplicate-post

PHPCS Error: Wrong escaping function. HTML attributes should be escaped by esc_attr(), not by esc_html_e()

Open
#259 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
53
Forks
38
Avg merge
4d 8h
Merged PRs (30d)
1

Description

When running a PHPCS scan, the following error is present:

Wrong escaping function. HTML attributes should be escaped by esc_attr(), not by esc_html_e() (WordPressVIPMinimum.Security.ProperEscapingFunction.htmlAttrNotByEscHTML).

For this line: https://github.com/Yoast/duplicate-post/blob/trunk/src/admin/views/options.php#L247

esc_attr_e should be used instead of esc_html_e

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open src/admin/views/options.php around line 247 and review the PHPCS warning for the attribute escaping call. Replace the incorrect escaping usage with the function named in the issue, then run PHPCS to confirm the warning is gone.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
web-dev
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.