Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active July 27, 2021 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/7b275d76ba2c8750655a3b77f3cc6ac0 to your computer and use it in GitHub Desktop.
Save woogists/7b275d76ba2c8750655a3b77f3cc6ac0 to your computer and use it in GitHub Desktop.
[Frontend Snippets] Allow HTML in term (category, tag) descriptions
/**
* Allow HTML in term (category, tag) descriptions
*/
foreach ( array( 'pre_term_description' ) as $filter ) {
remove_filter( $filter, 'wp_filter_kses' );
if ( ! current_user_can( 'unfiltered_html' ) ) {
add_filter( $filter, 'wp_filter_post_kses' );
}
}
foreach ( array( 'term_description' ) as $filter ) {
remove_filter( $filter, 'wp_kses_data' );
}
@ArneSaknussemm
Copy link

ArneSaknussemm commented Jul 27, 2021

Why do you loop in a single element array?
The term_description function doesn't do that filter. Maybe was deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment