Can you add the visual editor to the description field for custom taxonomies?

The question:

Can you add the visual editor to the description field for custom taxonomies? It would be nice to have this option available when you edit an entry for a taxonomy be it core or custom.

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Just wrote the function. It’ll display the tinymce editor in every custom taxonomy description right now. Surely you can edit to show it for only some specific taxonomy.

/**
 * Display advanced TinyMCE editor in taxonomy page
 */
function wpse_7156_enqueue_category() {
    global $pagenow, $current_screen;

    if( $pagenow == 'edit-tags.php' ) {
        require_once(ABSPATH . 'wp-admin/includes/post.php');
        require_once(ABSPATH . 'wp-admin/includes/template.php');

        wp_tiny_mce( false, array( 'editor_selector' => 'description', 'elements' => 'description', 'mode' => 'exact' ));
    } 
}
add_action( 'init', 'wpse_7156_enqueue_category' );

You can provide the first argument in wp_tiny_mce as true if you want a stripped version of tinyMCE

Method 2

Have you tried The Rich Text Tags Plugin?

  • It does exactly what you need.
  • Works with custom taxonomies.
  • Works well with images.
  • Includes the new WP internal linking.
  • It is regularly updated.

Screenshot:

Rich Text Tags Screenshot

Method 3

Not directly, no.

You could, however, write a custom javascript which applies the appropriate classes to the entry field for the custom taxonomy description.

If what you really want to do, however, is create a “many-to-many” relationship between posts (e.g. a post type of “Tires” and a post type of “Cars”), then WordPress doesn’t (currently) have a facility for this. However, the Posts 2 Posts plugin does provide this functionality (and gives you a lot more flexibility to create complex relationships).


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment