Several modules display the description of a term on the term view page. Because of this it's nice to be able to edit term descriptions with a WYSIWYG interface (such as TinyMCE). Would this be hard to achieve in TM?

#13 x_term_description.zip1.19 KBJCB

Comments’s picture

or simple BUEditor integration - this is very need. Please.

temp’s picture

Yes - this is very usefull option!

temp’s picture

Version: 5.x-1.0 » 6.x-1.x-dev

now BUEditor can't appear in 'description' form

belpix’s picture

it would be great if someone implement this in Wysiwyg module, or just tell the hack

temp’s picture

FCKeditor witch enabled popup window - is good solution!

klonos’s picture


JayNL’s picture

This is the first time I'm saying this, and no matter how I hate such replies... here I am: Subscribing!


Oh that was easy... Just 1 line of extra code in and here we are... It works! and especially this comment solved my problem. Now there's a nice WYSIWYG editor to edit my taxonomy term descriptions. Very nice!

Fenwick’s picture

Would you care to share what that one line of extra code is and exactly where you put it? The thread you linked to still isn't clear to me.

JayNL’s picture

sure Fenwick, here goes. Be aware that this way actually sucks, because on a next update of the, your line of code would be gone...

Look at the comment I linked to:

Open up and find this code:

  $form['body']['body'] = array(
    '#type' => 'textarea',
    '#title' => check_plain($type->body_label),
    '#default_value' => $node->body,
    '#required' => FALSE,
    '#row' => 4,
    '#resizable' => FALSE,

Replace it with this:

  $form['body']['body'] = array(
    '#type' => 'textarea',
    '#title' => check_plain($type->body_label),
    '#default_value' => $node->body,
    '#required' => FALSE,
    '#row' => 4,
    '#resizable' => FALSE,
  $form['body']['format'] = filter_form($node->format, NULL, array('body_format')); // to integrate wysiwyg

and done :)

m.stenta’s picture

I'm not sure where you're seeing that code, JayNL... it doesn't appear anywhere in the core Taxonomy module, or in the Taxonomy Manager module. And even if it did, I don't see how the 1 line that was added worked, because it uses the $node variable, which isn't available in the context of the term edit form. It looks like you copied it directly from the comment you cited (, which makes no reference to the Taxonomy module at all. It appears to be someone's custom code, or code for applying WYSIWYG filters to a node edit form. I don't mean to call you out on what you wrote, I just found your comment to lead me into more confusion. Please only post solutions if you've tested them, otherwise don't claim them to be solutions. That said, your comment did point me in the direction of the real solution...

There is a clean and easy way to enable WYSIWYG support for term descriptions via a very small custom module. All it requires is a form_alter that adds the same one line to the form (with some modification to make it work in this context). No need to edit any core code...

 * Implementation of hook_form_alter().
function mymodule_form_alter(&$form, $form_state, $form_id) {
  // Add WYSIWYG support for taxonomy term descriptions
  if ($form_id == 'taxonomy_form_term') {
    $form['identification']['format'] = filter_form(2);

It uses the same function, filter_form(), applied to the 'identification' fieldset (that's created by the taxonomy module). Notice that I used "2" as the only argument. This is specific to my implementation, and should be changed based on what input filter you're using on your site. Since I'm the only one editing terms on my site, I used filter format 2, which is the Full HTML filter on my setup. If you leave it blank, the default filter format will be used.

Hope that helps someone, and maybe it can be integrated into Taxonomy Manager as well.

JayNL’s picture

I was actually hoping somebody would come up with a nicer solution, so thanks a lot mstenta for your help!!

m.stenta’s picture

Upon further testing, it seems that this only partially works. The term description is passed through xss_filter_admin() before being displayed, which is a very lenient filter, but does not allow 'object' or 'embed' tags, so it won't work for everything.

The following tags will work (taken from

'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'col', 'colgroup', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins', 'kbd', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'

JCB’s picture

Thanks mstenta,

I used your code and created a module for you guys.
This is my first module ever; so bare with me.

Take note that you will have to enable WYSIWYG as well as enable a editor.
Make sure you can get the wysiwyg interface for editing nodes - you should then see the wysiwyg interface on the term edit pages


mikeefreedom’s picture


Works like a dream mate!!

Thanks JCB and mstenta.

drupalmess’s picture

Hmmm... not doing it for me. Using the x_term_description module above, and changing the filter_form() function to use my default settings, I get the expected 'Input format' field added to the Introduction fieldset with the correct default setting, but the description field remains a non-wysiwyg resizable textarea, and I get the following error in a javascript alert:

Error: The TEXTAREA with id or name set to "" was not found

What am I missing?

NaX’s picture

To get around the the filter_xss_admin issue you can override it in your theme.

Something like. (take note of 'mytheme_' and '$MYFORMAT')

 * Render a taxonomy term page HTML output.
 * @param $tids
 *   An array of term ids.
 * @param $result
 *   A pager_query() result, such as that performed by taxonomy_select_nodes().
 * @ingroup themeable
function mytheme_taxonomy_term_page($tids, $result) {
  drupal_add_css(drupal_get_path('module', 'taxonomy') .'/taxonomy.css');

  $output = '';

  // Only display the description if we have a single term, to avoid clutter and confusion.
  if (count($tids) == 1) {
    $term = taxonomy_get_term($tids[0]);
    $description = $term->description;

    // Check that a description is set.
    if (!empty($description)) {
      $output .= '
'; $output .= check_markup($description, $MYFORMAT, FALSE); $output .= '
'; } } $output .= taxonomy_render_nodes($result); return $output; }
michalczernik’s picture


Thank you!
However for me this module enables the choice of input formats, and even if I choose FullHTML [this one should use WYSIWYG editor, and it does elsewhere] no WYSIWYG shows up.

Any ideas?!

JCB’s picture


In response to your query... I found that what the custom module does is enable a wysiwyg editor on the second field available on the page.

I know that some modules add additional fields above the term description field; an example of this is automatic title.

In the module's code you should be able to change the field number by modifying the number located here:
$form['identification']['format'] = filter_form(2);

-- change the filter_form(2) to filter_form(3) (just an example)

Hope this helps

mattgilbert’s picture


openthinktech’s picture


your solution worked for me! awesome!

dieppon’s picture

Have you tried wysiwyg extra?

It adds wysiwyg support to taxonomy descriptions