Edit File by line
/home/zeestwma/richards.../wp-inclu.../blocks
File: post-content.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/post-content` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/post-content` block on the server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 5.8.0
[10] Fix | Delete
*
[11] Fix | Delete
* @param array $attributes Block attributes.
[12] Fix | Delete
* @param string $content Block default content.
[13] Fix | Delete
* @param WP_Block $block Block instance.
[14] Fix | Delete
* @return string Returns the filtered post content of the current post.
[15] Fix | Delete
*/
[16] Fix | Delete
function render_block_core_post_content( $attributes, $content, $block ) {
[17] Fix | Delete
static $seen_ids = array();
[18] Fix | Delete
[19] Fix | Delete
if ( ! isset( $block->context['postId'] ) ) {
[20] Fix | Delete
return '';
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
$post_id = $block->context['postId'];
[24] Fix | Delete
[25] Fix | Delete
if ( isset( $seen_ids[ $post_id ] ) ) {
[26] Fix | Delete
// WP_DEBUG_DISPLAY must only be honored when WP_DEBUG. This precedent
[27] Fix | Delete
// is set in `wp_debug_mode()`.
[28] Fix | Delete
$is_debug = WP_DEBUG && WP_DEBUG_DISPLAY;
[29] Fix | Delete
[30] Fix | Delete
return $is_debug ?
[31] Fix | Delete
// translators: Visible only in the front end, this warning takes the place of a faulty block.
[32] Fix | Delete
__( '[block rendering halted]' ) :
[33] Fix | Delete
'';
[34] Fix | Delete
}
[35] Fix | Delete
[36] Fix | Delete
$seen_ids[ $post_id ] = true;
[37] Fix | Delete
[38] Fix | Delete
// When inside the main loop, we want to use queried object
[39] Fix | Delete
// so that `the_preview` for the current post can apply.
[40] Fix | Delete
// We force this behavior by omitting the third argument (post ID) from the `get_the_content`.
[41] Fix | Delete
$content = get_the_content();
[42] Fix | Delete
// Check for nextpage to display page links for paginated posts.
[43] Fix | Delete
if ( has_block( 'core/nextpage' ) ) {
[44] Fix | Delete
$content .= wp_link_pages( array( 'echo' => 0 ) );
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
/** This filter is documented in wp-includes/post-template.php */
[48] Fix | Delete
$content = apply_filters( 'the_content', str_replace( ']]>', ']]&gt;', $content ) );
[49] Fix | Delete
unset( $seen_ids[ $post_id ] );
[50] Fix | Delete
[51] Fix | Delete
if ( empty( $content ) ) {
[52] Fix | Delete
return '';
[53] Fix | Delete
}
[54] Fix | Delete
[55] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'entry-content' ) );
[56] Fix | Delete
[57] Fix | Delete
return (
[58] Fix | Delete
'<div ' . $wrapper_attributes . '>' .
[59] Fix | Delete
$content .
[60] Fix | Delete
'</div>'
[61] Fix | Delete
);
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
/**
[65] Fix | Delete
* Registers the `core/post-content` block on the server.
[66] Fix | Delete
*
[67] Fix | Delete
* @since 5.8.0
[68] Fix | Delete
*/
[69] Fix | Delete
function register_block_core_post_content() {
[70] Fix | Delete
register_block_type_from_metadata(
[71] Fix | Delete
__DIR__ . '/post-content',
[72] Fix | Delete
array(
[73] Fix | Delete
'render_callback' => 'render_block_core_post_content',
[74] Fix | Delete
)
[75] Fix | Delete
);
[76] Fix | Delete
}
[77] Fix | Delete
add_action( 'init', 'register_block_core_post_content' );
[78] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function