Last active
March 6, 2018 11:41
-
-
Save daggerhart/4fce93cfa23ff143f362 to your computer and use it in GitHub Desktop.
Allow HTML img tags in WordPress comments
This file contains 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
<?php | |
add_filter( 'wp_kses_allowed_html', array( $this, 'my_kses_allowed_html_hook' ), 20, 2 ); | |
function my_kses_allowed_html_hook( $tags, $context = null ){ | |
if ( 'post' == $context && ! isset( $tags['img'] ) ) { | |
$tags['img'] = array( | |
'src' => 1, | |
'height' => 1, | |
'width' => 1, | |
'alt' => 1, | |
'title' => 1 | |
); | |
} | |
return $tags; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment