PluginProbe
Gutenberg / 10.1.0
Gutenberg v10.1.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/block-library/blocks/post-content.php +1 -42 12.6.0 → 10.1.0 View file →
@@ -13,58 +13,17 @@
13 13 * @param WP_Block $block Block instance.
14 14 * @return string Returns the filtered post content of the current post.
15 15 */
16 16 function gutenberg_render_block_core_post_content( $attributes, $content, $block ) {
17 - static $seen_ids = array();
18 -
19 17 if ( ! isset( $block->context['postId'] ) ) {
20 18 return '';
21 19 }
22 20
23 - $post_id = $block->context['postId'];
24 -
25 - if ( isset( $seen_ids[ $post_id ] ) ) {
26 - // WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
27 - // is set in `wp_debug_mode()`.
28 - $is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG &&
29 - defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY;
30 -
31 - return $is_debug ?
32 - // translators: Visible only in the front end, this warning takes the place of a faulty block.
33 - __( '[block rendering halted]' ) :
34 - '';
35 - }
36 -
37 - $seen_ids[ $post_id ] = true;
38 -
39 - // Check is needed for backward compatibility with third-party plugins
40 - // that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
41 - if ( ! in_the_loop() && have_posts() ) {
42 - the_post();
43 - }
44 -
45 - // When inside the main loop, we want to use queried object
46 - // so that `the_preview` for the current post can apply.
47 - // We force this behavior by omitting the third argument (post ID) from the `get_the_content`.
48 - $content = get_the_content();
49 - // Check for nextpage to display page links for paginated posts.
50 - if ( has_block( 'core/nextpage' ) ) {
51 - $content .= wp_link_pages( array( 'echo' => 0 ) );
52 - }
53 -
54 - /** This filter is documented in wp-includes/post-template.php */
55 - $content = apply_filters( 'the_content', str_replace( ']]>', ']]>', $content ) );
56 - unset( $seen_ids[ $post_id ] );
57 -
58 - if ( empty( $content ) ) {
59 - return '';
60 - }
61 -
62 21 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'entry-content' ) );
63 22
64 23 return (
65 24 '<div ' . $wrapper_attributes . '>' .
66 - $content .
25 + apply_filters( 'the_content', str_replace( ']]>', ']]&gt;', get_the_content( null, false, $block->context['postId'] ) ) ) .
67 26 '</div>'
68 27 );
69 28 }
70 29