/** * Update the meta value for the single view checkbox. * * @param integer $post_id The post ID being passed on save. * * @return void */ function save_checkbox($post_id) { // Do our nonce comparison. if (empty($_POST['svo_meta_nonce']) || !wp_verify_nonce(sanitize_key($_POST['svo_meta_nonce']), 'svo_meta_nonce')) { return; } // Run various checks to make sure we aren't doing anything weird. if (false === RKV_SVO_Helper::meta_save_check($post_id)) { return; } // Check against the post types we've allowed. if (!in_array(get_post_type($post_id), RKV_SVO_Helper::get_post_types())) { return; } // Check for the true value being posted. if (!empty($_POST['svo-active'])) { update_post_meta($post_id, '_svo_active', sanitize_key($_POST['svo-active'])); } else { delete_post_meta($post_id, '_svo_active'); } }