Posted By

f6design on 11/29/11


Tagged

wordpress tinymce wysiwyg


Versions (?)

Ensure TinyMCE is loaded for Wordpress (for meta boxes)


 / Published in: PHP
 

If you are creating a custom post type in Wordpress, and turn off the 'editor' capability, then TinyMCE is not loaded. This means any WYSIWYG meta box textareas will fail. Add this snippet to your theme's functions.php file to load the required TinyMCE JS and styles.

  1. /**
  2.  * Ensure TinyMCE is loaded.
  3.  * Required to use TinyMCE in meta boxes.
  4.  */
  5. add_action("admin_head","myplugin_load_tiny_mce");
  6.  
  7. function myplugin_load_tiny_mce() {
  8. wp_tiny_mce( false ); // true gives you a stripped down version of the editor
  9. }

Report this snippet  

You need to login to post a comment.