Make WordPress Core

Opened 19 months ago

Last modified 19 months ago

#56663 new enhancement

`tag_escape()` does not follow naming convention.

Reported by: peterwilsoncc's profile peterwilsoncc Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Formatting Keywords:
Focuses: coding-standards Cc:

Description

In WordPress, escaping functions generally use the naming convention esc_thing().

The tag_escape() function and it's associated hook do not. Is it worth renaming each to either esc_tag or the more precise esc_html_tag?

There is some use within the plugin repository but not a huge amount.

Change History (2)

#1 @dingo_d
19 months ago

I'm for the esc_html_tag option. Would be more precise and in line with the other escaping functions 👍🏼

#2 @SergeyBiryukov
19 months ago

It looks like tag_escape() was introduced to match attribute_escape(), but then got missed when attribute_escape() was replaced with esc_attr():

  • [4656] introduced attribute_escape().
  • [7497] introduced tag_escape().
  • [11103] turned attribute_escape() into a wrapper for attr().
  • [11204] renamed attr() to esc_attr().
  • [13096] deprecated attribute_escape() in favor of esc_attr().

I think esc_tag() would be more in line with esc_attr().

Last edited 19 months ago by SergeyBiryukov (previous) (diff)
Note: See TracTickets for help on using tickets.