wp_pre_kses_block_attributes

The timeline below displays how wordpress function wp_pre_kses_block_attributes has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Removes non-allowable HTML from parsed block attribute values when filtering
 * in the post context.
 *
 * @since 5.3.1
 *
 * @param string         $content           Content to be run through KSES.
 * @param array[]|string $allowed_html      An array of allowed HTML elements
 *                                          and attributes, or a context name
 *                                          such as 'post'.
 * @param string[]       $allowed_protocols Array of allowed URL protocols.
 * @return string Filtered text to run through KSES.
 */
function wp_pre_kses_block_attributes($content, $allowed_html, $allowed_protocols)
{
    /*
     * `filter_block_content` is expected to call `wp_kses`. Temporarily remove
     * the filter to avoid recursion.
     */
    remove_filter('pre_kses', 'wp_pre_kses_block_attributes', 10);
    $content = filter_block_content($content, $allowed_html, $allowed_protocols);
    add_filter('pre_kses', 'wp_pre_kses_block_attributes', 10, 3);
    return $content;
}

WordPress Version: 6.1

/**
 * Removes non-allowable HTML from parsed block attribute values when filtering
 * in the post context.
 *
 * @since 5.3.1
 *
 * @param string         $string            Content to be run through KSES.
 * @param array[]|string $allowed_html      An array of allowed HTML elements
 *                                          and attributes, or a context name
 *                                          such as 'post'.
 * @param string[]       $allowed_protocols Array of allowed URL protocols.
 * @return string Filtered text to run through KSES.
 */
function wp_pre_kses_block_attributes($string, $allowed_html, $allowed_protocols)
{
    /*
     * `filter_block_content` is expected to call `wp_kses`. Temporarily remove
     * the filter to avoid recursion.
     */
    remove_filter('pre_kses', 'wp_pre_kses_block_attributes', 10);
    $string = filter_block_content($string, $allowed_html, $allowed_protocols);
    add_filter('pre_kses', 'wp_pre_kses_block_attributes', 10, 3);
    return $string;
}

WordPress Version: .10

/**
 * Remove non-allowable HTML from parsed block attribute values when filtering
 * in the post context.
 *
 * @since 5.3.1
 *
 * @param string         $string            Content to be run through KSES.
 * @param array[]|string $allowed_html      An array of allowed HTML elements
 *                                          and attributes, or a context name
 *                                          such as 'post'.
 * @param string[]       $allowed_protocols Array of allowed URL protocols.
 * @return string Filtered text to run through KSES.
 */
function wp_pre_kses_block_attributes($string, $allowed_html, $allowed_protocols)
{
    /*
     * `filter_block_content` is expected to call `wp_kses`. Temporarily remove
     * the filter to avoid recursion.
     */
    remove_filter('pre_kses', 'wp_pre_kses_block_attributes', 10);
    $string = filter_block_content($string, $allowed_html, $allowed_protocols);
    add_filter('pre_kses', 'wp_pre_kses_block_attributes', 10, 3);
    return $string;
}