使用PHP更新WordPress中当前用户的元数据

I've got a button on my website posts to a PHP page. I can't seem to make my PHP code update the user meta data for the currently logged in user. The page is intended to allow users to change a specific meta key upon pressing the button. Does anyone know what I'm doing wrong? Any help is greatly appreciated.

<?php
  if(isset ($_POST ['go']){
  $user_ID = $current_user->ID;
  $CustomMeta = "4";
  update_user_meta($user_ID, 'CustomMeta', $CustomMeta);
}
?>

Get Current logged in user id -

<?php $user_ID = get_current_user_id(); ?>

Did you include wp-load.php in your page.