Add wysiwyg editor in WordPress Meta Box


Add this code in functions.php for Add wysiwyg editor in WordPress Meta Box:


  1. Hello!
    Thanks for the cool script. But is there a way to add a second meta-box within this script and make it visible in my custom post types? I hope you can help me out with this…thanks in advance!

    • Only you need to Replace “post” with your custom post type Name for example add_meta_box(WYSIWYG_META_BOX_ID, __('Custom WYSIWYG Meta Box', 'wysiwyg') , 'custom_wysiwyg', 'event'); in this code event is custom post type name.

  2. Hello,

    Thanks a lot for the script! However how do you print it in the Front End of a template? I’m using the following code but the problem is that it displays the HTML (in the editor) as text:

    $CustomWysiwyg = get_post_meta(get_the_ID(), ‘custom_wysiwyg’, true);
    echo $CustomWysiwyg;

    I really don’t find the way to print well… Thanks you!

    • Hi Mathieu,
      Your Code is correct for call Editor Value, if you are add shortcode in your editor then you need to add do_shortcode() for print data like as:
      $CustomWysiwyg = get_post_meta(get_the_ID(), ‘custom_wysiwyg’, true);
      echo do_shortcode($CustomWysiwyg);


Please enter your comment!
Please enter your name here