# Visual Editor for Category and Tag Descriptions

> Replaces the plain description box on the category and tag edit screens with the visual editor, and keeps headings, lists, images and links that WordPress would otherwise strip.

- Type: PHP
- Runs: Run everywhere
- Category: [Archives](https://wpide.com/library/category/archive/)
- Tags: archives, categories, editor
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/visual-editor-for-term-descriptions/

## Code

```php
// Taxonomies whose edit screen gets the visual editor for the description.
$wpide_rich_description_taxonomies = array( 'category', 'post_tag' );

// Keep headings, images, lists and links in descriptions (WordPress normally allows only a few inline tags).
add_action( 'init', function () {
    if ( current_user_can( 'manage_categories' ) ) {
        remove_filter( 'pre_term_description', 'wp_filter_kses' );
        add_filter( 'pre_term_description', 'wp_filter_post_kses' );
    }
} );

foreach ( $wpide_rich_description_taxonomies as $wpide_rich_tax ) {
    add_action( $wpide_rich_tax . '_edit_form_fields', function ( $term ) {
        echo '<tr class="form-field wpide-rich-description"><th scope="row"><label for="wpide_term_description">Description</label></th><td>';

        wp_editor( $term->description, 'wpide_term_description', array(
            'textarea_name' => 'description',
            'textarea_rows' => 10,
            'media_buttons' => current_user_can( 'upload_files' ),
        ) );

        echo '<p class="description">Shown on the archive page if your theme displays descriptions.</p></td></tr>';
    } );
}

// Hide the plain description box that the editor replaces.
add_action( 'admin_head-term.php', function () use ( $wpide_rich_description_taxonomies ) {
    if ( in_array( get_current_screen()->taxonomy, $wpide_rich_description_taxonomies, true ) ) {
        echo '<style>.term-description-wrap{display:none}</style>';
    }
} );

add_action( 'admin_footer-term.php', function () use ( $wpide_rich_description_taxonomies ) {
    if ( in_array( get_current_screen()->taxonomy, $wpide_rich_description_taxonomies, true ) ) {
        // Remove the original field so only the editor's value is submitted.
        echo '<script>(function(){var row=document.querySelector(".term-description-wrap");if(row){row.parentNode.removeChild(row);}})();</script>';
    }
} );
```

## Notes

Your theme must display term descriptions; add other taxonomies to the list at the top.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Visual Editor for Category and Tag Descriptions" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
