Skip to content

Commit

Permalink
Post content block: apply the_content filter before checking if conte…
Browse files Browse the repository at this point in the history
…nt is empty (#31997)

* Post content block: apply the_content filter before checking if content is empty

* Simplify duplicate logic
  • Loading branch information
Aljullu authored May 20, 2021
1 parent a68142b commit f3a5763
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/block-library/src/post-content/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,15 @@ function render_block_core_post_content( $attributes, $content, $block ) {
}

$content = get_the_content( null, false, $post_id );
/** This filter is documented in wp-includes/post-template.php */
$content = apply_filters( 'the_content', str_replace( ']]>', ']]>', $content ) );
unset( $seen_ids[ $post_id ] );

if ( empty( $content ) ) {
unset( $seen_ids[ $post_id ] );
return '';
}

$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'entry-content' ) );
/** This filter is documented in wp-includes/post-template.php */
$content = apply_filters( 'the_content', str_replace( ']]>', ']]>', $content ) );
unset( $seen_ids[ $post_id ] );

return (
'<div ' . $wrapper_attributes . '>' .
Expand Down

0 comments on commit f3a5763

Please sign in to comment.