I have not tested this, but my guess is that $_POST
is not set when the post is saved when wp_cron
changes the status from “Scheduled” to “Published”, and so your value gets saved/reset to 0.
Instead of using save_post
you could hook to the several transition hooks that fit your needs.
Or you could remove your action for the one or more transitions that seem to be problematic. For example:
add_action(
'pending_to_publish',
function($post) {
remove_action('save_post', 'k2_feature_meta_save_details');
}
);
Untested, but I hope that helps.