Post Meta

Last Updated: August 20, 2021

If you want to hide the meta values appearing on the Custom Field meta box you have to define the mata key starting with _ (underscore)

Get Meta Values

get_post_meta($post_id,'_appointment_status',true)

Add Meta Values

This is the best way to add meta values

if (isset($_POST['_appointment_status'])) {
      $sanitized = sanitize_text_field($_POST['_appointment_status']);
      update_post_meta($post_id, '_appointment_status', $sanitized);
}

Update Meta Values