web-stories-wp: Broken story markup for users without `unfiltered_html` capabilities
Bug Description
I noticed this while debugging a story. Not sure how it happened, but in this case there was no closing </strong>
tag on a text element.
Why P0?
This broken markup led to a completely broken layout on the frontend. It was impossible to read the story.
Possibly related: #413, #1007, #1093.
Expected Behaviour
There should never be broken markup like this.
Steps to Reproduce
Drafts:
- Log in as user with role Author
- Create a new story
- Add a new text element
- Make the text bold
- Add a new image
- Rotate image
- Preview story
- Notice how story is broken
Published stories:
- Log in as user with role Author
- Create a new story
- Publish story
- Add a new text element
- Make the text bold
- Add a new image
- Rotate image
- Preview story
- Notice how story is broken
Screenshots

Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance Criteria
QA Instructions
Drafts:
- Log in as user with role Author
- Create a new story
- Add a new text element
- Make the text bold
- Rotate element
- Add background color with opacity
- Preview story
- Verify story is displayed as expected
Published stories:
- Log in as user with role Author
- Create a new story
- Publish story
- Add a new text element
- Make the text bold
- Add a new image
- Rotate image
- Preview story
- Story should be displayed as expected
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16 (8 by maintainers)
I was able to reproduce this issue! 🎉
It’s not really about
<strong>
tags, but about markup in general.Prerequisites for testing
Why Author role? Well, that role does not have the
unfiltered_html
capability, which means our story data and generated markup will be passed throughwp_filter_post_kses
in WordPress…and breaks.To reproduce:
<span style="font-weight: 700">Fill in some text</span>
Meanwhile, the database will look like this:
post_content
:post_content_filtered
:@miina This might ring a bell for you, since we had to deal with this in the old editor as well: https://github.com/ampproject/amp-wp/pull/2691
I reproduced this on a new test account on stories-lab.dev. Adding a text element was not necessary for me – a completely blank story will be broken. So this might be a separate bug unless I’m missing something.
My guess for the missing
</strong>
tag issue is that it was due to a missing migration path for stories created on an older release.