I have created a new custom post type and some custom fields for it. My function for saving the custom meta fields fires on the 'save_post' hook.
The problem is that I am getting a warning when I go to add a new post:
Notice: Undefined index: my_meta_box_nonce....
// verify nonce
if ( ! wp_verify_nonce( $_POST[ 'my_meta_box_nonce' ], basename( __FILE__ ) ) )
return $post_id;
When I enter the post details and hit publish the error is not displayed, it's only there when I create a new empty post. What's wrong here?
My code is almost identical and based on this tutorial: http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-1-intro-and-basic-fields/
In the comments of that tutorial it seems that there were others who had the same problem, but there is no solution given.