I'm trying to create meta box on a post create/edit page. I faced the problem:
1. When I create a post from scratch the data from my meta box is saved as expected
2. When I try to update an existing post with a new meta box data the data is not saved.
I experimented with a couple of action hooks which I got from wordpress docs and none of them seem to work. Please check the code below:
<?
add_action('save_post','callback'); // works when a post is created from scratch
add_action('update_post','callback'); // doesn't work
add_action('pre_post_update','callback'); // doesn't work
add_action('publish_post','callback'); // doesn't work
function callback( $post_ID ) {
echo "THE POST IS SAVED";
// Code for saving metabox here
...
};
Don't see any reason why this thing is not working as expected. If anyone faced the same issues please help! I'm desperate
Have a nice day!