Skip to content

WordPress enable html in category description

Recently I needed to enable html in category descriptions so that I could add a featured image to each of my category.
Here is the solution.

wp_filter_kses
wp_kses_data

/**
 * Allow HTML in term (category, tag) descriptions 
         * Note : You may want to restrict access to who can edit category description or of the sort.
         * Removing the filter will enable anyone to insert html/javascript code (which may be malicious)
 */
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' );
}

I will release a small quick plugin for this when I have the time (hopefully soon)

 

Enjoyed the content ? Share it with your friends !
Published inDevelopmentProgramming

Be First to Comment

Leave a Reply

Your email address will not be published.