_wp_apply_block_content_filters()
Applies standard content filters similar to the the_content
This function runs the typical content processing filters that WordPress applies to post content, useful for blocks that render nested content.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
string. The processed content.
Usage
_wp_apply_block_content_filters( $content, $context, $seen_ids, $id );
- $content(string) (required)
- The content to process.
- $context(string)
- Context identifier for wp_filter_content_tags().
Default:empty string - $seen_ids(array|null) (passed by reference — &)
- Reference to an array tracking seen IDs for recursion prevention.
Default:null - $id(string|null)
- Unique identifier for this content, used with
$seen_ids.
Default:null
Notes
Global. WP_Embed. $wp_embed WordPress Embed object. |
Changelog
| Since 7.1.0 | Introduced. |
_wp_apply_block_content_filters() wp apply block content filters code WP 7.1
function _wp_apply_block_content_filters( $content, $context = '', &$seen_ids = null, $id = null ) {
$content = shortcode_unautop( $content );
$content = do_shortcode( $content );
if ( null !== $seen_ids && null !== $id ) {
$seen_ids[ $id ] = true;
}
try {
$content = do_blocks( $content );
} finally {
if ( null !== $seen_ids && null !== $id ) {
unset( $seen_ids[ $id ] );
}
}
$content = wptexturize( $content );
$content = convert_smilies( $content );
$content = wp_filter_content_tags( $content, $context );
global $wp_embed;
$content = $wp_embed->autoembed( $content );
return $content;
}