You can hook into tiny_mce_before_init to modify the TinyMCE arguments to set the readonly attribute.
For example (using PHP 5.3):
add_filter( 'tiny_mce_before_init', function( $args ) {
// do you existing check for published here
if ( 1 == 1 )
$args['readonly'] = 1;
return $args;
} );
This will make the TinyMCE readonly, however it won’t make the HTML editor readonly (that’s not TinyMCE) and it also won’t stop people using the Media Upload to insert images. However, that might not be an issue – because I would recommend you implement some server-side checking to prevent edits, as it’s always possible for someone to send whatever content they want from the browser by manipulating the DOM etc.
Related Posts:
- How to add a shortcode button to the TinyMCE editor?
- How to load wp_editor via AJAX
- How to Add WYSIWYG Editor (tinyMCE) to plugin options page compatible with WordPress 3.0 and up?
- TinyMCE Advanced newline problem
- Disable text tab on WordPress text-editor
- Issues creating a tinyMCE plugin that creates a custom link
- Adding rich text editor to my plugin
- How to Add TinyMCE’s plugin in wordpress?
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- How can I get the post content displayed in a text field that allows to edit posts?
- How to add custom JS to tinymce in wordpress
- how to load tinymce external plugin
- Getting selected (highlighted) html from the Visual Editor on Edit Post page?
- How to edit content before post update
- How to replace wordpress default text editor (TinyMCE) with a custom one.
- accessing wp.media api from a tinymce plugin
- How to load wp_editor via AJAX
- jquery tinymce and bundled wp plugins
- Trouble adding tiny mce to textarea in custom plugin
- Using TinyMCE in plugin?
- TinyMCE Styles Dropdown not adding html tags other than span
- Hook into existing tinyMCE button
- How to add table class for tables of TinyMCE advanced wordpress plugin? [closed]
- Is there a good way to load tiny_mce_popup.js through editor.windowManager.open?
- Generate Own Custom CSS Button with icon
- How do I add multiple buttons to Tiny MCE in a single plugin?
- “switchEditors is not defined” with wp_editor() in jQuery UI tabs
- Example for use tinymce in wordpress 3.5.1?
- Custom characters of tinymce editor are saved as question mark
- “After file loaded” action
- How to disable tinyMCE button added by a plugin?
- How to apply to hide TinyMCE (wp_editor) on button click
- How to hide the cell properties and row properties in TinyMCE WordPress?
- How to use wp_editor and save its data in wp_posts table
- How to disable/enable PHP plugin functionality based on a TinyMCE toggle-button
- Sanitize AROUND shortcode
- TinyMCE how to add css when inputing a text
- can’t use span or icon tags on when editing visual composer element
- Extending the “Add Media”-Dialog … how do I finally insert something to the Post?
- how to enable tinymce custom buttons in meta box?
- Better code/text editing for posts and pages?
- Filter html of WordPress editor in visual mode only
- Using Iris Colorpicker on TinyMCE shortcodes page [duplicate]
- How can I replace the built in WordPress editor?
- How to append TinyMCE editor in TinyMCE editor’s popup
- Get a list of all registered actions
- How can I force a file download in the WordPress backend?
- What’s a reliable way to depend on another plugin?
- Woocommerce – Hide “add to cart” on free products
- WordPress apply_filters() Arguments Missing
- How to hide /wp-content/uploads/ from URL?
- Add image to post from external URL
- User profiles and object associations
- WordPress plugin search does not work and updates are not shown, VPS install
- Gutenberg: Difference between “import” and “const” for dependencies
- Custom data-id wp_enqueue_script
- Should I host support forum on wordpress.org or my own website?
- How to setup a Network Plugin across the network with only my settings?
- Is it possible to insert images directly from the server?
- Read text defined under __()
- Plugin Customization Lost During Plugin Upgates
- Plugin activation hook in an abstract class
- How to make wp_enqueue_style and wp_enqueue_script work only on custom post type
- Can I use custom CSS and js plugin to put JavaScript in to validate my forms
- Redirection of users away from wp-admin (but not administrators)
- WordPress Plugin [closed]
- Cannot update user display_name field
- WP plugins for Product web catalog [closed]
- User Signup in Multisite – Need Plugin or Advice
- Plugin – Social media share buttons
- Notice: Uninitialized string offset: 0 in social sharing mu-plugin
- Adding Static Image to WooCommerce Content-Single-Product template
- how can I query all wordpress users of a blog
- Automate paragraphs in a post page to have a unique anchor link
- Error in pdf generating plugin using FPDF
- How to create WordPress custom end point with multiple parameters?
- Text change in Advanced Customs Fields [closed]
- After updating the WordPress getting a syntax error in the console
- How to use apply_filters?
- Call a function for social sharing
- How to get authors who have added the post in the specific custom post type
- Get product categories and add them to a custom taxonomy
- I want to add the below chatbot html code to index(main) file of WordPress sites how can I do that
- Mobile Menu and Mobile Sidebar missing
- Changing the CSS with a plugin
- How come W3TC is allowed to host premium code in the WordPress repo?
- Passing function into add_action always returns the first argument
- Unable to to self-deactivate plugin using deactivate_plugins()
- How To Add Code To WP Without Plugin or Functions
- Enahanced search for edit.php and custom post type
- Different plugins activated online and offline
- Find And Add Category to Posts
- Advice on setting up private site
- is ther a plugin that will hide/show content for a scheduled period of time? [closed]
- 404 not found problem with URL rewrite custom category
- Loading post that has visual composer data inside lightbox? [closed]
- Manage Inventory Without Displaying Levels
- How to save mediaupload multiple URLs as array meta?
- Ajax Load More stopped working (Plugin with repeater template, shows hidden Button)
- WordPress Share Buttons Plugin: How do you make the WordPress Share Buttons Display Vertically?