Skip to content

Commit 9219d64

Browse files
committed
Target embeds already wrapped in a <p> tag
1 parent b90ed7f commit 9219d64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

includes/embeds/class-amp-facebook-embed-handler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public function render( $args ) {
112112
* @param Document $dom DOM.
113113
*/
114114
public function sanitize_raw_embeds( Document $dom ) {
115-
$embed_nodes = $dom->getElementsByTagName( $this->amp_tag );
116-
115+
// If there were any previous embeds in the DOM that were wrapped by `wpautop()`, unwrap them.
116+
$embed_nodes = $dom->xpath->query( "//p/{$this->amp_tag}" );
117117
if ( $embed_nodes->length ) {
118118
foreach ( $embed_nodes as $embed_node ) {
119119
$this->unwrap_p_element( $embed_node );

0 commit comments

Comments
 (0)