What are allowed HTML in wp_kses_post function?

Viewed 1423
1 Answers

To check the list of allowed tags and attributes for wp_kses_post you can use

echo '<pre>';
print_r( wp_kses_allowed_html( 'post' ) );
echo '</pre>';
die();

In your case, where only a and strong allowed, you can use wp_kses function (docs) instead

$allowed_html = [
    'a' => [
        'id' => true,
        'href'  => true,
        'title' => true,
    ],
    'strong' => [],
]; 
$clear_post = wp_kses( $post, $allowed_html );
Related