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?
- Disable email notification after change of password
- Get a list of all WordPress.org Plugins?
- Schedule WordPress Auto-Updates to only run during business hours
- Make thumbnails in woocommerce replace the main image instead of opening fancybox
- Run WP-CLI using PHP
- Function to Set Product type in Woocommerce [closed]
- Trying to get logged-in user data inside php class
- Calling function from within functions.php returns unwanted value
- WordPress Plugin Boilerplate – add_action hook in static “activate” function
- add function to saving change on Options Pages
- Opendir and WordPress Path
- Has anyone used require.js for handling plugin scripts?
- Edits to plugin not taking effect
- Multiple files in a plugin
- Gutenberg Blocks – Change EDIT part of the block using editor.BlockEdit filters. How to change the markup?
- Make the checkbox meta field checked by default
- adding a new value to a serialized array in WP_option table
- WordPress Automatic Plugin Update Renames Plugin Directory
- When to call add_filter
- Date calculations from 2 custom fields
- Easiest way to add dropdown to a page
- WPBakery JS composer unused css [closed]
- DROP TABLE with uninstall hook not working
- Setup page on first login on multisite
- Integrate Facebook comments with native comments
- Batch update of WordPress Plugins
- Is there a function to list all uploaded images? How can I add one?
- How use wp media upload liberary in react components?
- Passing Parameters from shortcode to enqueue script
- site url is not working after migrtaion in worpress, all links are broken
- If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
- How to deactivate my plugin upon deactivation of NextGen
- Simple sildeshow/image-upload plugin?
- Summary and Comments on Main landing Page
- Manualy Updated WordPress Error
- Register PODS Custom Field with WPGraphQL [closed]
- www redirects to another directory in wordpress
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Block Google tracking on refuse consent of the user with plugin
- Disable plugin for administrator
- Modify Plugin PHP Class in Child Theme – Correct Method
- WordPress wp-admin redirects to home page
- Customize a widget position
- How to add the functionality of WordPress needed to be installed to be mandatory while installing themes
- Editing Global Variables from Inside Functions
- building custom simple shopping cart using wordpress plugin
- Posting code inside the post instead of in the template file using shortcode
- Very Slow loading. Plugins report provided by P3 included
- overwrite a plugin function in functions.php
- How to list the categories by custom taxonomy created?
- Allow users to enter and edit data in one-to-many configuration
- Facebook comment into my blog
- Distribute post content through several divs [closed]
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]
- contact form 7 captcha support anyother captcha plugin? [closed]
- How to modify submit button on GravityForms