-
Notifications
You must be signed in to change notification settings - Fork 384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent wpautop()
from modifying Twitter embed
#3874
Conversation
Oh, I see. This now brings to mind an issue we had with placeholder content in This being the case, I am wary of modifying the behavior of |
Just wanted to point out that dynamic blocks are rendered by preventing |
wpautop()
last on post contentwpautop()
from modifying Twitter embed
0ef896f
to
118facf
Compare
Rebased to remove the commit messing with |
Yes that makes sense. |
} | ||
$content = AMP_DOM_Utils::get_content_from_dom( $dom ); | ||
|
||
$this->assertEquals( $content, $expected ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pierlon For PHPUnit assertion, the expected value always comes first, followed by the actual value.
This is important because PHPUnit will tell you what it expected, and what it got instead. If you put the values in the wrong order (like here), this is misleading and causes you to look in the wrong places.
I'm rectifying this in #3758, as I'm touching those tests anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks for pointing that out, noted 👍 .
Summary
The cause of the duplication was due to
wpautop()
mucking with the content, wrapping tags it deems as "block-level" with a<p>
which causes theblockquote
tag to be placed outside the AMP component. Once outside, theblockquote
is santitized as a raw embed and another Twitter AMP component would be rendered.Removing the HTML oEmbed filter in
AMP_Twitter_Embed_Handler
will allow forwpautop
to process the original HTML, and allows the raw embed sanitizer within the class to convert it into an AMP component, without any interference.Fixes #3865.
Checklist