$seen_ids[ $post_id ] = true;
// Check is needed for backward compatibility with third-party plugins
// that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
if ( !
in_the_loop() &&
have_posts() ) { the_post();
} // When inside the main loop, we want to use queried object
// so that `the_preview` for the current post can apply.
// We force this behavior by omitting the third argument (post ID) from the `get_the_content`.
$content =
get_the_content();
// Check for nextpage to display page links for paginated posts.
if ( has_block( 'core/nextpage'
) ) { $content .=
wp_link_pages( array
( 'echo' => 0
) );
} /** 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 ) ) { return '';
}