X

Add TinyMCE Editor to Post/Page Title Input Field

Snippets by IsItWP

Are you looking for a way to add the TinyMCE editor to the title input field of your WordPress posts and pages? While there’s probably a plugin for this, we have created a quick code snippet that you can use to add TinyMCE editor to post/page title input field in WordPress.

Instructions:

All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:


function tinymce_title_js(){ ?>
<script type="text/javascript">
	jQuery(document).ready( tinymce_title );
            function tinymce_title() {
		jQuery("#title").addClass("mceEditor");
		tinyMCE.execCommand("mceAddControl", false, "title");
	    }
</script>
<?php }
add_action( 'admin_head-post.php', 'tinymce_title_js');
add_action( 'admin_head-post-new.php', 'tinymce_title_js');

function tinymce_title_css(){ ?>
<style type='text/css'>
	    #titlewrap{border:solid 1px #e5e5e5 !important;}
	    tr.mceLast{display:none;}
	    #title_ifr{height:50px !important;}
</style>
<?php }
add_action( 'admin_head-post.php', 'tinymce_title_css');
add_action( 'admin_head-post-new.php', 'tinymce_title_css');

Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly add code snippets in WordPress, so you don’t accidentally break your site.

If you liked this code snippet, please consider checking out our other articles on the site like: 46 biggest brands in the world using WordPress actively and how to create a custom user registration form in WordPress.

Comments  Leave a Reply

  1. Just change:
    tinyMCE.execCommand(“mceAddControl”, false, “title”);
    for:
    tinyMCE.execCommand(“mceAddEditor”, false, “title”);

  2. not working at my wp site

  3. Nice addition/snipt, but… why?

  4. Thanks for this. Is there any way to have this display in the html editor as well or instead of the visual? – opps, posted on the wrong article, sorry.

  5. Great snippet! I wonder is there any way to display and use only selected items of tinyMCE? Surely we don’t need to have the uploader buttons for the title area 🙂

    1. Thanks, glad you like the snippet, I think we can remove items however I’m not sure how easy it would be to do that just for the TinyMCE used for the title.

      1. how to remove unused items from tinymce? a good idea for a future snippet =) 

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!
[63% OFF Today!]
[63% OFF Today!]
[63% OFF Today!]
[63% OFF Today!]
[63% OFF Today!]
[63% OFF Today!]
[60% OFF Today!]
[60% OFF Today!]
[50% OFF Today!]
[50% OFF Today!]