WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#44835 reviewing defect (bug)

Add a hidden input for 'original_post_status' to the inline-edit rows so it's available on the $_POST in save_post — at Initial Version

Reported by: garrett-eclipse Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch needs-refresh needs-testing
Focuses: administration Cc:

Description

Hello,

Can we add a hidden input for 'original_post_status' into the '.inline-edit-save' div found in the inline-edit rows so that it's available on the $_POST object form save_post as it is when you save a post from the post edit screen.

Background: I am writing a plugin for a client to introduce Draft Revisions on published posts. I have a cleanup function tied to save_post which purges the Draft Revisions if the post being saved has a status of 'publish' or was previously 'publish'. From normal post submission the original_post_status is available on the $_POST as it's a hidden input on the post editor. From inline-edits this fails as there's no hidden input for original_post_status.

I searched for some time to come up with a solution and settled on a jquery trigger which injected the missing input when the inline-edit row opens. With it present the existing ajax/etc fires properly and populated the missing $_POSToriginal_post_status? that I required.

Proposition: Add the hidden input for original_post_status onto the inline edit rows to make that information available to save_post.

Thank you

Change History (0)

Note: See TracTickets for help on using tickets.