Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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