I have a proprietary plugin that creates a metabox on the edit-post page. When the data managed by the plugin is edited and the user navigates away then we would like the user to be prompted as Wordpress (or is it TinyMCE?) does now when the body of the article is edited. Ideally, if the user modifies the metabox and the post content they would be prompted once.

Is there an API which allows us to activate Wordpress' (or is it TinyMCE's?) dirty flag?

I am aware of this similar question and the answer whcih suggests proxying the beforeunload event.

1 Answer 1


The problem is "When the data managed by the plugin is edited. You have to set your own dirty-flag (e.g. a value in a hidden input field, setup a js-variable) and check your dirty-flag if the user leave the page. But how could you check if the data in the metabox is edited? Are there some suitable hooks in the plugin? If not, you can use jQuery/JS OnChange events if the metabox contains input fields. Our simply check the input fields in the metabox (empty or not).

It would be fine to know what the metabox contains or the plugin itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.