Avoid updating post when sending POST or GET request to post.php

I’ve created a Plugin which adds a new meta-box on the post.php dashboard page, containing a form. Whenever a POST request is submitted from that form, I would like to save some post meta-data.

I have been able to implement this, but I noticed that each time this POST request is sent, the entire blog post gets updated, including changes that were made outside my meta-box. It’s as if I was pressing the default “Update” button instead of my own form submit button.

Read More

Is there a way to send a POST (or GET) request to post.php without having it interpreted as a request to save all changes to the blog post? There must be such a possibility, since refreshing that page from a browser does not cause the blog post to automatically be updated.

I know I could probably do this using AJAX, but I’d like to avoid that if possible. Also, I’m using WordPress 3.4.1.

Related posts

Leave a Reply

1 comment

  1. The metabox itself sits inside a form which encompasses (almost) the entire page. You’re metabox callback shouldn’t print a form itself (since you’ll end up with nested forms). Instead the meta data should be updated when the post itself is updated, using the save_post hook.

    The only way of updating part of the post’s metadata without updating the entire post is to use Ajax.