WPDev.one
Core Function
View Source on Trac ↗

filter_block_content()

filter_block_content( mixed $text, mixed $allowed_html = 'post', mixed $allowed_protocols = array() )

Filters and sanitizes block content to remove non-allowable HTML

Parameters 3 required

Name / Type Description
$text
string

Text that may contain block content.

Required
mixed

(array[] | string) $allowed_html Optional. An array of allowed HTML elements and attributes, or a context name such as 'post'. See wp_kses_allowed_html() for the list of accepted context names. Default 'post'.

Required
string[]

$allowed_protocols Optional. Array of allowed URL protocols. Defaults to the result of wp_allowed_protocols().

Required

Return Value

(string)
The filtered and sanitized content result.

Function Information

Since Version
5.3.1
Source File
wp-includes/blocks.php
Advertisement