Embarrassingly big hole in my understanding!

When I've finished editing a post and click the big blue "Update" button, what happens next? In particular, how does the 'pre-post-update' hook (which, being php, exists only on the server) manage to intercept my request?

I imagine that either there's something clever going on with Ajax, or - more likely? - that the button action reloads the page, giving the hook a chance to do its thing.

The practical application is as follows:

I have a metabox where (amongst other things) I allow the user to re-order the rows of a table using jQuery UI Sortable. Rather than update the database every time the user re-orders the table or by having a separate "Save changes" button, I'd prefer to have the updating happen when the blue WordPress "Update" button is pressed.

The names of some of the WordPress hooks ('save_post', 'pre_post_update') seduced me into thinking I could use them to capture this client-side data - but if the page has to reload before they're called, this is presumably not possible.

The nearest I've got to an answer is in this impressive labour of love: http://humanshell.net/2011/08/14/wordpress-initialization/ Now, if someone could do the same sort of explanation for what happens when the "Update" button is pressed...

Many thanks if you can help to put me out of my ignorance!

1 Answer 1


Yes, the page reloads. The form data is sent as a POST request to the server for processing. Whatever your jQuery script does needs to be reflected in some sort of input field(s) so that data can be passed to the server and intercepted by your save_post action.


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.