Skip to content

Instantly share code, notes, and snippets.

@nikitasinelnikov
Created December 30, 2025 09:31
Show Gist options
  • Select an option

  • Save nikitasinelnikov/f8b0247d96971fd4a754ee0d5f67f54b to your computer and use it in GitHub Desktop.

Select an option

Save nikitasinelnikov/f8b0247d96971fd4a754ee0d5f67f54b to your computer and use it in GitHub Desktop.
Allow iframe for the user_description field. It's not recommend due to security
function um_wp_kses_user_desc( $tags, $context ) {
if ( 'user_description' === $context || 'pre_user_description' === $context ) {
$allowed_html = UM()->get_allowed_html( 'templates' );
if ( empty( $allowed_html['iframe'] ) ) {
$allowed_html['iframe'] = array(
'allow' => true,
'frameborder' => true,
'loading' => true,
'name' => true,
'referrerpolicy' => true,
'sandbox' => true,
'src' => true,
'srcdoc' => true,
'title' => true,
'width' => true,
'height' => true,
'allowfullscreen' => true,
);
}
$tags = $allowed_html;
}
return $tags;
}
add_filter( 'wp_kses_allowed_html', 'um_wp_kses_user_desc', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment