JavaScript for WordPress › Forums › Gutenberg Development › wpautop behavior for dynamic blocks › Reply To: wpautop behavior for dynamic blocks
December 13, 2018 at 1:48 pm
#76394
Participant
🙂 i think i found it, It happens in your 12-dynamic example also.(maybe you can confirm it for me )
If you use get_the_excerpt() (and i think get_the_content() also ) it will trigger the wpautop filter.
For ex
foreach ( $recent_posts as $post ) {
$post_id = $post['ID'];
$markup .= get_the_excerpt($post_id).sprintf(
'<li>
<a href="%1$s">%2$s</a>
line1
line2
</li>',
esc_url( get_permalink( $post_id ) ),
esc_html( get_the_title( $post_id ) )
);
}
$markup.='</ul>';
Here is a screenshot http://prntscr.com/luhguk
Can you confirm my findings ? Thank you