It seems the problem might be that you haven’t added a nonce – so when the post is being saved, you are failing the nonce check.
Try adding
<?php wp_nonce_field('my_meta_box_nonce','meta_box_nonce'); ?>
to your metabox. Remember the nonce action (in this case my_meta_box_nonce
) should be
- unique to the action (saving a property),
- unique to an object (e.g. the property’s ID),
- and unique to your (your plug-in name).
Also – for these types of debugging questions use var_dump
and wp_die
to output variables and kill the processing (for instance, in your save_property
function to see if that function is being called / where the function is aborted).
Not related to you original question, but you should use get_post_meta
rather than get_post_custom
.
Finally, I don’t think you want to use wp_kses
for the property ID. This is an expensive function, intended to strip out some HTML tags but allow others. If the ID is just a number, use intval
or sanitize_key
for alpha-numerics.