diff --git a/packages/block-library/src/block/index.php b/packages/block-library/src/block/index.php
index 3613680e9e515..8b0227f43c45f 100644
--- a/packages/block-library/src/block/index.php
+++ b/packages/block-library/src/block/index.php
@@ -25,17 +25,6 @@ function render_block_core_block( $attributes ) {
}
if ( isset( $seen_refs[ $attributes['ref'] ] ) ) {
- if ( ! is_admin() ) {
- trigger_error(
- sprintf(
- // translators: %s is the user-provided title of the reusable block.
- __( 'Could not render Reusable Block %s. Block cannot be rendered inside itself.' ),
- $reusable_block->post_title
- ),
- E_USER_WARNING
- );
- }
-
// WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
// is set in `wp_debug_mode()`.
$is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG &&
diff --git a/packages/block-library/src/post-content/index.php b/packages/block-library/src/post-content/index.php
index 4c0c4965647f1..400e3068dfa0a 100644
--- a/packages/block-library/src/post-content/index.php
+++ b/packages/block-library/src/post-content/index.php
@@ -23,19 +23,11 @@ function render_block_core_post_content( $attributes, $content, $block ) {
$post_id = $block->context['postId'];
if ( isset( $seen_ids[ $post_id ] ) ) {
- if ( ! is_admin() ) {
- trigger_error(
- sprintf(
- // translators: %s is a post ID (integer).
- __( 'Could not render Post Content block with post ID: %s
. Block cannot be rendered inside itself.' ),
- $post_id
- ),
- E_USER_WARNING
- );
- }
-
+ // WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
+ // is set in `wp_debug_mode()`.
$is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG &&
defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY;
+
return $is_debug ?
// translators: Visible only in the front end, this warning takes the place of a faulty block.
__( '[block rendering halted]' ) :
@@ -44,7 +36,7 @@ function render_block_core_post_content( $attributes, $content, $block ) {
$seen_ids[ $post_id ] = true;
- if ( ! in_the_loop() ) {
+ if ( ! in_the_loop() && have_posts() ) {
the_post();
}
diff --git a/packages/block-library/src/template-part/index.php b/packages/block-library/src/template-part/index.php
index c210d1a123be6..4f52b0f6d1738 100644
--- a/packages/block-library/src/template-part/index.php
+++ b/packages/block-library/src/template-part/index.php
@@ -73,21 +73,11 @@ function render_block_core_template_part( $attributes ) {
}
if ( isset( $seen_ids[ $template_part_id ] ) ) {
- if ( ! is_admin() ) {
- trigger_error(
- sprintf(
- // translators: %s are the block attributes.
- __( 'Could not render Template Part block with the attributes: %s
. Block cannot be rendered inside itself.' ),
- wp_json_encode( $attributes )
- ),
- E_USER_WARNING
- );
- }
-
// WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
// is set in `wp_debug_mode()`.
$is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG &&
defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY;
+
return $is_debug ?
// translators: Visible only in the front end, this warning takes the place of a faulty block.
__( '[block rendering halted]' ) :