Opened 4 years ago
Last modified 6 months ago
#55714 reopened defect (bug)
& stored as & for Post Title and Excerpt in Editor
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Editor | Keywords: | has-test-info has-screenshots |
| Focuses: | Cc: |
Description
Hi,
When an Author/other user(who have Create post permission) creates a post and add a post title as Hello & Welcome to WordPress after save the post the post title is stored as Hello & Welcome to WordPress in DB. As this is stored like this it is showing same in the editor. This is happening with Excerpt also.
NB: This is not happening with Admin user or if you are using Gutenberg Editor.
Reproduce Steps:
- Disable your gutenberg editor and enable classic editor.
- Logged in as an Author.
- Switch to a non block based theme. (skip if your theme is not block based)
- Go to Post > Add New
- Add Post Title, Excerpt as
Hello & Welcome to WordPress - Save Post
- You will see
Hello & Welcome to WordPressas title
Attachments (2)
Change History (15)
#3
@
4 years ago
There is a security concern while storing the title in DB.
So can we do one thing here, just decode the html entity while displaying in editor?
if that something make sense. so that we do not need work on the existing implementation.
#5
@
7 months ago
- Keywords close added
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
Hi
If this, as described, only happens in the classic editor, then the issue needs to be opened in the repository for the classic editor plugin, not WordPress core Trac.
#6
@
7 months ago
@poena The Classic Editor plugin provides the ability to switch back to the classic editor. The functionality itself remains in WordPress core. Am I missing something?
#7
@
7 months ago
- Keywords close removed
- Resolution invalid deleted
- Status changed from closed to reopened
No, you are absolutely right, I don't know what I was thinking (maybe wishful thinking ;) )
#9
@
7 months ago
- Keywords has-screenshots added
Reproduction Report
Description
This report validates whether the issue can be reproduced.
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.29.0
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: macOS
- Theme: Twenty Fourteen 4.2
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Steps to Reproduce
- Disabled Gutenberg editor and ensured Classic Editor was active
- Logged in as an Author user (not Admin)
- Used a non-block based theme (Twenty Fourteen)
- Created new post with title and excerpt containing ampersands: "Hello & Welcome to WordPress"
- Saved the post
- Examined the saved post
Actual Results
❌ Error condition does NOT occur.
Both the title and excerpt correctly display the ampersand character "&" rather than as "&".
Supplemental Artefacts
#10
@
7 months ago
The editor's title field had this after I saved a post as an Author-level user:
<input type="text" name="post_title" size="30" value="Hello &amp; welcome after saving" id="title" spellcheck="true" autocomplete="off" />
The front end has & in the markup, which appears as & there.
#11
@
7 months ago
@sabernhardt Thanks for testing it. I believe the & is appearing on the API result as well.
Removing
trunkas theVersionas I also reproduced this in WordPress 4.8. This may have been occurring for longer though, I just haven't tested less than 4.8.