Back to Top

How to add TinyMCE editor to Category Description?

html editor

Today I am going to explain how to add WYSIWYG editor to category description. Sometimes you want detailed HTML text as a description in category page so you can mostly prefer to use the plugin but which is not good to use the plugin because we can do it with small piece of code.

In this article, I will explain function which enables the WordPress TinyMCE editor on the Edit Category page of the admin panel and you can add/edit the descriptions the same way you add/edit posts content.

Let’s understand by code:

First of all, we use filter hook which edit category form and replace text area with an editor.Then after I have used action hook which is used to set style sheet of an editor.

That’s it. Place above code into your theme’s function.php file and run the code into browser :).

Read:

Convert RGB to Hex HTML code in PHP
The DocType In HTML
Clean HTML content in PHP

Hope this helps someone else out.As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (6)

  1. I have use this code, it is running fine,
    Thanks for this nice code

  2. This work with woocommerce category description?
    It did not work for me

    1. This code is not for woocommerce category description. For woocommerce category description, you need to use woocommence action hooks.

  3. it did add wysiwyg but when I save it every thing is lost

  4. Amazing, thank you! But i think, for save description in html format need add:


    // allow html in category and taxonomy descriptions
    remove_filter( 'pre_term_description', 'wp_filter_kses' );
    remove_filter( 'pre_link_description', 'wp_filter_kses' );
    remove_filter( 'pre_link_notes', 'wp_filter_kses' );
    remove_filter( 'term_description', 'wp_kses_data' );

  5. Hi,

    How about on taxonomy? I think it works only on the category but not on the taxonomies

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to create Custom regions in Drupal

Posted on 11 years ago

Bhumi

HTML5 Geolocation API with Example

Posted on 7 years ago

Bhumi