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.
Our Sponsors
Essential plugins for your WooCommerce store
Build unbuildable WordPress websites
The best no-code Instagram feed plugin for WordPress

The code below 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.

[php]
function change_editor_body_class($init){
$init[‘body_class’] = ‘my_class’;
return $init;
}

add_filter(‘tiny_mce_before_init’, ‘change_editor_body_class’);
[/php]

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

Jean Galea
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 Mastermind.fm podcast. His personal blog can be found at jeangalea.com.

Consider sharing this post so others can find it:

Share on facebook
Share on twitter
Share on linkedin
Share on reddit
Share on telegram
Share on whatsapp
Share on pocket
Share on email

Join thousands of people receiving real-world, genuine evaluations of WordPress products and services just like this one every week.

Table of Contents

Leave a Reply

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

The Beginner’s Handbook
From an introduction on how WordPress works to our recommendations on products and services.

Join thousands of people receiving real-world, genuine evaluations of WordPress products and services

A single weekly email directly to your inbox.