How to Enable TinyMCE for Post Excerpts Box

Here’s some neat code that will enable the TinyMCE rich text editor within your excerpts box. You can now insert links and other HTML into your excerpts.

This code should be inserted into your theme’s functions.php, or better still create a plugin out of it.

function tinymce_excerpt_js(){ ?>
<script type="text/javascript">
jQuery(document).ready( tinymce_excerpt );
function tinymce_excerpt() {
tinyMCE.execCommand("mceAddControl", false, "excerpt");
tinyMCE.onAddEditor.add(function(mgr,ed) {
ed.settings.theme_advanced_buttons2 ="";
ed.settings.theme_advanced_buttons1 = "bold,italic,underline,seperator,justifyleft,justifycenter,justifyright,separator,link,unlink,seperator,pastetext,pasteword,removeformat,seperator,undo,redo,seperator,spellchecker,";
<?php }
add_action( ‘admin_head-post.php’, ‘tinymce_excerpt_js’);
add_action( ‘admin_head-post-new.php’, ‘tinymce_excerpt_js’);
function tinymce_css(){ ?>
<style type=’text/css’>
#postexcerpt .inside{margin:0;padding:0;background:#fff;}
#postexcerpt .inside p{padding:0px 0px 5px 10px;}
#postexcerpt #excerpteditorcontainer { border-style: solid; padding: 0; }
<?php }
add_action( ‘admin_head-post.php’, ‘tinymce_css’);
add_action( ‘admin_head-post-new.php’, ‘tinymce_css’);

function prepareExcerptForEdit($e){
return nl2br($e);
add_action( ‘excerpt_edit_pre’,’prepareExcerptForEdit’);

Found via

If you enjoyed this post, make sure to subscribe to WPMayor’s RSS feed.

About Jean Galea

Jean Galea is a WordPress developer, entrepreneur and padel player. He is the founder of WP Mayor, the plugins WP RSS Aggregator and EDD Bookings, as well as the podcast. His personal blog can be found at

Related Articles

  • Change TinyMCE Editor Class

    This hack will change TinyMCE's default class, useful for styling the post editor to look like the front end of your site. This function goes into your theme's functions.php file.

  • Add an Excerpt Box for Pages

    This hack will add the same "excerpt" box which you are familiar with on the "Add/Edit Post" admin area and duplicate that functionality on the "Add/Edit Page" section. Now you…

  • Set Post Revisions to Avoid DB Bloat

    Post Revisions can significantly bloat the size of your database. Here's how to change the default unlimited number of revisions to 5, by using this hack which needs to be…

One Response

  1. Darko
    Darko December 15, 2015 at 03:39 | | Reply

    Is there a way to DISABLE TinyMCE (Advanced) for WooCommerce Shoprt Description (like excerpt field) ?

Leave a Reply