Created
December 30, 2025 09:31
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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