Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Use esc_attr__() instead of _e() in header.php aria-label #1374

Open
jaredcaraway opened this issue Mar 29, 2019 · 0 comments
Open

Use esc_attr__() instead of _e() in header.php aria-label #1374

jaredcaraway opened this issue Mar 29, 2019 · 0 comments
Assignees
Milestone

Comments

@jaredcaraway
Copy link

I set up CodeSniffer in VS Code tonight for the first time using the WP Coding Standards as well as the included codesniffer config file.

One error it threw was in header.php, line 28: "All output should be run through an escaping function (like esc_html_e() or esc_attr_e()), found '_e'."

The error was referring to the following line of code:
<button aria-label="<?php _e( 'Main Menu', 'foundationpress' ); ?>" class="menu-icon" type="button" data-toggle="<?php foundationpress_mobile_menu_id(); ?>"></button>

After a quick Google of the issue, it looks like esc_attr__() may be more appropriate for returning a translated attribute value. This was added by @aldavigdis in this commit.

Or is there a specific reason for using _e() instead? I'm not a WP expert, so it's entirely possible I'm overlooking something. I'd be glad to submit a PR if appropriate. Thanks!

@derweili derweili added this to the v2.10.6 milestone Apr 4, 2019
@derweili derweili self-assigned this Apr 4, 2019
@derweili derweili modified the milestones: v2.10.6, v2.11.0 Apr 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants