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
- TinyMCE – Unable to load the editor in vue front-end plugin page
- wp_enqueue_style for plugin options page
- Popular Post With Thumbnail?
- Moving to a WordPress blog. What do I need to know?
- WP-nivo-slider Producing Error “Cannot modify header information – headers already sent by …”
- Is changing post from category in a large blog a good practice?
- How to keep track of new plugins published on wordpress.org?
- Contact Form 7 – Show image on successful send? [closed]
- Is this a plug-in in wordpress or a custom JavaScript
- What is generating Similar Posts and Related Posts on my blog?
- Default plugin config to override wp_options?
- Performance impact with inactive plugins? [duplicate]
- Best portfolio/gallery/carousel slideshow plugin with thickbox? [closed]
- Disable plugin only for one post
- Placing the two most voted posts at the top (in a WordPress site that uses the Vote it up plugin)?
- Is there any plugin which enables users to rate comments in thumbs up-down way?
- custom uploader in the admin area
- Plugin Repostitory Questions
- Timed content and flagging content as viewed by user?
- How do I add the same contact form to multiple wordpress sites and capture the response in one place or database?
- eLearning Module
- Add SideBar/Widgets Just Below the Post
- Amazon.com intergration with WordPress?
- How to best create a jQuery Slider to display a native wordpress gallery?
- Free paypal cart solution [closed]
- Best/Correct way to add an option to a category
- Are there action hooks for comments?
- Help with WP Business Directory Manager Plugin?
- “W3 Total Cache” with “What Would Seth Godin Do” (and widgets?!)? [closed]
- Add filter on html tags,attributes on specific function in wordpress
- XML Sitemap Generator can’t notify google and bing
- cforms plugin function “my_cforms_logic” (for writing custom logic), is running 5 times
- Adding rel=”nofollow” to external links in posts?
- Best Sitemap Plugin for 1M+ pages [closed]
- Collecting email addresses via a “beta” sign up form
- Plugin that provides the [edit] shortcode?
- Which plugin can do horizontal scrolling of RSS feeds in WordPress [closed]
- How to limit image size for the entire website ? But without editing the post (css/plugin?!)
- Problem installing plugin: unexpected T_STRING, expecting T_FUNCTION
- How do I get the Twitter Tools widget to display my tweets?
- Why are my WordPress store items showing up in duplicates?
- When I try to de-activate any plugin it gives error “Warning: call_user_func_array() [function.call-user-func-array]”
- Plugins for logo in wp themes? [closed]
- How to remove js ui library added by default by wordpress
- Is there a plugin for automatically adding a word or symbol after a trigger word? I.e. Like a search and replace but more like search and add? [closed]
- How to set category correctly for a custom post created by a remote API call?
- Can I do in-page changes binding events/triggers to actions in WordPress?
- Can inactive WordPress plugins still load scripts?
- What is the best way to cache pages on WordPress
- How to see which sites use my installed plugins (wordpress multisite)
- Product count in archive page Title in WooCommerce [closed]
- Use current class method inside add_submenu_page()
- how remove font to increase site speed load
- Plugin main file is constantly been fired on every website visit
- Why is Google Search Console getting X-Robots-Tag noindex?