Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#47328 closed defect (bug) (reported-upstream)

Apostrophe use in WordPress posts and pages with escaping issues

Reported by: eagleangel Owned by:
Milestone: Priority: normal
Severity: blocker Version: 5.2
Component: Editor Keywords:
Focuses: ui, administration Cc:


I raised a ticket with Yoast at https://github.com/Yoast/wordpress-seo/issues/12970 due to an issue I thought was with the Yoast SEO plugin, yet it turns out it is a flaw in the WordPress software coding.

If you have a word or phrase wrapped with apostrophes for single quote marks, or you have two or more words with apostrophes in the same paragraph, you can have issues where the apostrophes are not escaped in the output for PHP and JavaScript purposes. Because (I am assuming) Gutenberg is supposed to help those who know little to no HTML, I feel this is a serious flaw to a degree.

Whilst semantically it is incorrect to do so, most people do use apostrophes as single quote marks due to the fact that the correct character is not available on a standard computer keyboard. Those who do know about HTML entities can overcome this issue, but can we please have WordPress software correct the HTML output with ' when the apostrophe is typed?

Thinking about the issue, maybe double quotation marks should also be substituted with ".

The only issue I can see with this is that a forewarning would need to go out to plugin and theme developers such as WooCommerce before the changes are implemented as it may affect the way data is saved, retrieved and outputted within their plugins etc.

Change History (4)

#1 @eagleangel
2 years ago

I forgot to mention also, that using ' in an HTML block or within the code editor mode does not help as the WordPress software substitutes ' with an apostrophe mark.

#2 @SergeyBiryukov
2 years ago

  • Component changed from General to Editor
  • Focuses coding-standards removed

This ticket was mentioned in Slack in #core by desrosj. View the logs.

2 years ago

#4 @karmatosed
2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

I have reported this ticket here: https://github.com/WordPress/gutenberg/issues/15816 as all tickets relating to the new editor Gutenberg are to be made on the GitHub repo. If you'd like to follow along to the fix discussion will happen there. Thanks.

Note: See TracTickets for help on using tickets.