Autoresize for wp_editor (the TinyMCE editor) in WordPress 4.0+

A lovely feature finding its way into the default post editor for WordPress is autoresizing. This means that you no longer have to scroll up and down inside the editor, it will expand to fit your content automatically removing the scrollbars. It is even better now that the toolbar will always stay in view.

If you are using wp_editor to create custom editing instances, you can take advantage of this feature too. Previously I was using an autoresize plugin for TinyMCE but now it is as simple as passing in a setting.

    '', // content
    'yourcustomeditorid', // a unique id in lowercase letters
        'tinymce' => array(
		'resize' => false, // disables the ability to resize the editor with the mouse
		'wp_autoresize_on' => true // editor expands to fit content
    ) // settings array

Leave a Reply

Your email address will not be published. Required fields are marked *