Make WordPress Core

Opened 6 years ago

Last modified 9 months ago

#44310 reopened defect (bug)

Apostrophe and/or Hyphen in Titles Rendered as ’ and – When Added as Link in Editor

Reported by: midihead's profile midihead Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9.6
Component: Editor Keywords: has-screenshots needs-patch
Focuses: Cc:

Description

I searched but did not see this issue reported previously.

When an apostrophe and/or a hyphen is present in a blog post title or page title and those posts are added as links using the Insert Link option in the WordPress Editor, the apostrophe and hyphen are rendered as the following:

  • An apostrophe in a title is rendered as ’ in the Link Text (see attached images)
  • A hyphen (which is surrounded by spaces) in a title is rendered as – in the Link text (see attached images)

I have tested on a vanilla WordPress 4.9.6 install with no other plugins active both on live installs on two different servers and a local development server and can reproduce this consistently.

Attachments (5)

WordPress Issue 2.png (104.0 KB) - added by midihead 6 years ago.
WordPress Issue 1.png (91.4 KB) - added by midihead 6 years ago.
WordPress Issue 3.png (94.8 KB) - added by midihead 6 years ago.
WordPress Issue 4.png (100.9 KB) - added by midihead 6 years ago.
Screenshot from 2018-06-06 18_40_50.png (9.0 KB) - added by subrataemfluence 6 years ago.

Download all attachments as: .zip

Change History (13)

#1 @midihead
6 years ago

  • Summary changed from Apostrophe and/or Hyphen in Titles Rendered as ’ and When Added as Link in Editor to Apostrophe and/or Hyphen in Titles Rendered as ’ and – When Added as Link in Editor

#2 @subrataemfluence
6 years ago

  • Keywords needs-patch removed
  • Resolution set to invalid
  • Status changed from new to closed

I could not reproduce the issue. Please see screenshot.

#3 @midihead
6 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

Thanks for your response. I'm not sure that I clearly explained the issue the first time. In your screenshot, it appears that you typed out the apostrophe and the hyphen as text in the body of the editor instead of inserting a link to an existing post or page that already contains an apostrophe and/or hyphen (with spaces) in the title.

Steps to reproduce:

  1. Create a post or page and insert an apostrophe and/or a hyphen (with spaces) in the title and save it.
  2. In any post or page, click the Insert/Edit Link button, search for the existing post that has the apostrophe and/or hyphen (with spaces) in the title, select that post from the list and click Apply.
  3. The inserted link will render the apostrophe as ’ and the hyphen (with spaces) as –

To more clearly demonstrate how to reproduce this issue, I have recorded a short video where I clearly show and explain how to consistently reproduce this issue. https://youtu.be/mPrzne9ZNkA

If you follow the steps above or in the video as I've shown, you should clearly see the issues with the apostrophe and hyphen occur.

Thank you very much.

#4 @midihead
6 years ago

This issue was reported 6 weeks ago. The issue was closed when you weren't able to reproduce the issue, however the methods you used to test appear to have been missing a key step (adding the link in the Editor for a post that contains an apostrophe or hyphen in the title). I previously posted a link to a video which clearly demonstrates how to reproduce the issue. I've been been able to reproduce the issue on every WordPress installation I manage, all of which are running different themes and plugins. I have verified that it is not the themes of plugins causing this. You response to my video demonstration would be appreciated. Thank you very much.

#5 @flipback8
6 years ago

I confirm that this issue is Active. I have reproduced the issue on my side.
http://prntscr.com/k7sn7m

A video has been provided illustrating the issue which makes it super simple to replicate. Please make time to watch. Thanks.

https://www.youtube.com/watch?v=mPrzne9ZNkA&feature=youtu.be

#6 @sabernhardt
3 years ago

#54133 was marked as a duplicate.

#7 @sabernhardt
3 years ago

  • Keywords needs-patch added

Also note: this happens with the straight apostrophe (not the curly single quotation mark).

#8 @ahmadkarim
9 months ago

This is still happening as of version 6.3.2

When getting post title through get_the_title() it will change ' with 8217 code

This is fixed when switching get_the_title() with get_post_field('post_title', $post_id)

Note: See TracTickets for help on using tickets.