I am trying to disable the tinyMCEeditor in wordpress so it is readonly
if the post has already been published. I already have the logic for determining if the post is published (by using $post
object’s post_status
variable)but I have not found a solution for setting the readonly
parameter in tinyMCE to true
.
Leave a Reply
You must be logged in to post a comment.
You can hook into
tiny_mce_before_init
to modify the TinyMCE arguments to set thereadonly
attribute.For example (using PHP 5.3):
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.