Tag: TinyMCE editor

HOWTO: Add TinyMCE to a Textarea in WordPress

If you are building a plugin or simply adding some custom fields for your theme and would like to use the WordPress Visual/HTML editor – you can – with one easy line of code:

<?php wp_editor( $content, $editor_id, $settings = array() ); ?>

No extra added JS or anything else is needed! It is that simple. (This was introduced with WordPress 3.3)

Used in a real world example (custom fields for a custom post type):

<?php wp_editor( $sdac_profile_general_description, 'sdac_profile_general_description' );?>

That outputs a text area with the name “sdac_profile_general_description” and the value of the custom field.

I hope this helps out next time you find yourself wanting the Visual/HTML editor in place but struggling to get all the needed JS/HTML in place.

Further Documentation: http://codex.wordpress.org/Function_Reference/wp_editor