Created
June 21, 2021 13:12
-
-
Save andcam/05829e404f47319dc7c1dd51d903e53a to your computer and use it in GitHub Desktop.
Wordpress: Allow HTML in term descriptions (disable KSES filter)
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
/* | |
* Allow HTML in term descriptions. | |
* https://developer.wordpress.org/reference/functions/wp_filter_kses/ | |
* | |
*/ | |
function ljxdm_disable_kses_on_terms() { | |
if ( current_user_can( 'unfiltered_html' ) ) { | |
foreach ( array( 'pre_term_description' ) as $filter ) { | |
remove_filter( $filter, 'wp_filter_kses' ); | |
} | |
} | |
foreach ( array( 'term_description' ) as $filter ) { | |
remove_filter( $filter, 'wp_kses_data' ); | |
} | |
} | |
add_action( 'init', 'ljxdm_disable_kses_on_terms' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment