Changeset 50137 for trunk/src/wp-includes/blocks/block.php
- Timestamp:
- 02/02/2021 05:14:46 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/block.php
r48177 r50137 14 14 */ 15 15 function render_block_core_block( $attributes ) { 16 static $seen_refs = array(); 17 16 18 if ( empty( $attributes['ref'] ) ) { 17 19 return ''; … … 23 25 } 24 26 27 if ( isset( $seen_refs[ $attributes['ref'] ] ) ) { 28 if ( ! is_admin() ) { 29 trigger_error( 30 sprintf( 31 // translators: %s is the user-provided title of the reusable block. 32 __( 'Could not render Reusable Block <strong>%s</strong>: blocks cannot be rendered inside themselves.' ), 33 $reusable_block->post_title 34 ), 35 E_USER_WARNING 36 ); 37 } 38 39 // WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent 40 // is set in `wp_debug_mode()`. 41 $is_debug = defined( 'WP_DEBUG' ) && WP_DEBUG && 42 defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY; 43 44 return $is_debug ? 45 // translators: Visible only in the front end, this warning takes the place of a faulty block. 46 __( '[block rendering halted]' ) : 47 ''; 48 } 49 25 50 if ( 'publish' !== $reusable_block->post_status || ! empty( $reusable_block->post_password ) ) { 26 51 return ''; 27 52 } 28 53 29 return do_blocks( $reusable_block->post_content ); 54 $seen_refs[ $attributes['ref'] ] = true; 55 56 $result = do_blocks( $reusable_block->post_content ); 57 unset( $seen_refs[ $attributes['ref'] ] ); 58 return $result; 30 59 } 31 60
Note: See TracChangeset
for help on using the changeset viewer.