You can filter the TinyMCE body classes to add or change as needed. It’s a string that’s pre-populated with some things like post type, so the easiest thing to do is append your additional classes (with a preceding space).
<?php
function wpse_128380_tinymce_body_class( $mce ) {
// you could do things here to detect whatever you need
// and use those for the additional classes.
// be safe and use sanitize_html_class or similar if generated.
// example: use the post ID when editing a post
if ( $post = get_post() ) {
$mce['body_class'] .= ' ' . sanitize_html_class( $post->ID );
}
$mce['body_class'] .= ' custom-class another-custom-class etc';
return $mce;
}
add_filter( 'tiny_mce_before_init', 'wpse_128380_tinymce_body_class' );
// if you're using the "teeny" version of the editor,
// it fires the teeny_mce_before_init filter instead.
Related Posts:
- Creating a wp_editor instance with custom tinyMCE buttons
- Remove HTML editor and visual/HTML tabs from TinyMCE
- How to get the input of a TinyMCE editor when using on the front-end?
- Load wp_editor via ajax [duplicate]
- TinyMCE 4.x : How to customize toolbar on wp_editor()
- How to use the new Dashicons for custom TinyMCE buttons?
- TinyMCE Anchor Button not showing
- “wp_editor” not displaying TinyMCE correctly when square brackets used in name
- Secure Validation of wp_editor in Theme Options
- Tiny MCE not adding p tag when saving theme option
- TinyMCE Editor Set Default Tab
- Registering custom TinyMCE buttons, for admin area, to work with custom instances of wp_editor
- Remove quicktag buttons but not Visual / Text editor and tabs
- TinyMCE editor – new lines not rendered on front end
- How to get WP editors tinyMCE instances
- TinyMCE strips line breaks on mceAddControl
- Count Words using tinymce in the front-end
- tinyMCE.activeEditor = null WP editor loaded in ‘Text’ mode?
- Add table controls with wp_editor minimal editor configuration (‘teeny’)
- Change Default Font Size and Remove Unwanted Font Sizes in TinyMCE
- TinyMCE Plugin Parameter
- wpeditor issue – shows both mode and not able to focus/edit during visual mode
- wp_editor on input changes content
- Limit Block format tags in WordPress wp_editor
- How to remove the statusbar from the default wordpress editor?
- wp.editor.initialize does not show the same default toolbar
- Stop WordPress Visual Editor converting backticks into code blocks
- TinyMCE Editor change underline button behavior – u tag instead of span text-decoration underline
- wordpress qtranslate editor text is not working [closed]
- Is it possible to disable the image alignment options in the post editor?
- How to dynamically generate wordpress editor on frontend?
- Change syntax styling of TinyMCE HTML Text Editor
- More than one TinyMCE (wp_editor) with different $settings[‘drag_drop_upload’] values breaks
- Adding custom styles to elements, without creating new elements
- wp_editor not modify html tags of initial content
- allowing all HTML tags in tinymce editor
- How to apply a custom skin to WP_Editor / TinyMCE?
- Stop editor from adding “amp;” after every “&”
- TinyMCE 4 & wp_editor multiple editor issue
- How to remove buttons from tinyMCE in wp_editor added via AJAX
- Loading a self-hosted custom @font-face into TinyMCE dropdowns (Classic Editor) via ‘tiny_mce_before_init’ filter
- Load WordPress Editor .css on Front End
- “Formats” Select Menu in WP Editor doesn’t show up with correct colour
- WordPress Editor without buttons
- Adding a class to custom TinyMCE button using WPLinks dialog box
- How to remove “justifyfull” in TinyMCE
- wp_editor Too Tall when Content is Loaded
- Inline Editing with wp_editor and tinymce (problem with textarea)
- Adding New Row of Custom TinyMCE
- Stop editor from removing tags and replacing them with nbsp
- Possible to stop WordPress from adding p1, p2… classes to p tags in TinyMCE?
- Custom Tiny MCE button to bring up a custom php popup
- How can I stop TinyMCE from converting my HTML entities to characters?
- How to keep non-breaking spaces in the visual editor?
- Detect a focus on wp_editor
- Remove “Are You Sure” dialogue when leaving editor
- Creating a custom MCE view for your shortcodes [closed]
- How to customize the symbols that appear in the Visual Editor insert custom character
- help on wp_editor via ajax load [duplicate]
- Disable TinyMCE autoformatting
- Keep pasted pre formatted code as it is -with tabs- in visual editor
- Insert text a cursor position in to TinyMCE text editor
- Using main style.css with add_editor_style
- Access tinymce from thickbox
- How can I troubleshoot why TinyMCE won’t load custom plugins in the visual editor?
- TinyMCE Editor as component in Gutenberg Block
- Set tinymce direction to rtl
- WordPress & TinyMCE: Failed to load
- How do I add a TinyMCE row that all users can see, instead of just admins?
- How to disable formatting
- Make TinyMCE checkbox that returns a value instead of true/false
- How to get line breaks to translate to paragraphs?
- How to remove buttons from the WP Editor on the edit post page in the admin area
- Localize variables with TinyMCE script
- Shift-Enter in tinyMCE (wp 3.3.1) not working
- TInyMCE object Tag stripped
- WordPress Tinymce editor broken and nothing seems to fix it :(
- Visual editor not showing all table rows
- tinymce.get() returns error after ajax request
- customize tiny MCE blockqute
- Save WYSIWYG editor plugin settings, only works after second save
- Front-end image upload from TinyME [closed]
- Embed iFrame in WordPress 3.0.1
- TinyMCE: Move buttons from 2nd row to top row
- Change the background of the TinyMCE editor with available WP arguments
- TinyMCE doesn’t work correctly in the Media Modal Window
- Wordpres Tinymce custom button (Gavick guide)
- tinymce and responsive line-breaks (short words after a period)
- Client on iPad accidentally adding tag to posts while writing
- Add custom TinyMCE 4 Button: Is it mandatory to have one JS per button?
- Nested ordered list in tinymce
- TinyMCE HTML Encode Backslash
- Revealing ‘code’ hidden button in TinyMCE4 and WordPress 3.9.x
- regEx wp core file
- Using TinyMCE fiddle for node filter to add id attribute to anchors
- WYSIWYG with HTML source?
- How do I separate my theme’s styles from editor styles?
- WordPress and TinyMCE Advanced: Failed to load javascript
- install tinymce plugin [closed]
- WordPress Started Executing Code Inside PRE Tags Even They Are Properly Escaped