plugin development – WordPress Admin panel: Custom submit button, need to suppress JS refresh dialog popup warning


Consider this workflow:

Custom post type that a special editor role [approver] will simply “approve or decline”, the normal PUBLISH metabox will be hidden, a custom button will instead be used. The [approvers] can change some data on the CPT, such as the title. (all built, hooked and working fine)

enter image description here

Creates this problem:

If any of the content has changed (title, custom meta fields, tags, ect..) then when that custom button is clicked WP-admin Js layer prevents the action from taking place (because the normal ‘publish’ button was not clicked) and as such a JS dialog box popups up like so:

enter image description here

This JS dialog popup is undesirable. In the final system the default PUBLISH METABOX will be hidden and the custom metabox will instead guide the [approver] to take the correct actions.

Christian Žagarskas 3 weeks 2023-05-21T12:42:54-05:00 0 Answers 0 views 0

Leave an answer