How to check if a PHP string is different than meta field?

I suppose it deleted the value when you had no URL in the content, so $audio_raw was empty.

if ($audio_raw && get_post_meta( $post_id, 'audio_url', true ) != $audio_raw) {
  // update the meta field
  update_post_meta( $post_id, 'audio_url', $audio_raw ); 
}

checks that $audio_raw isn’t false/null/empty and that $audio_raw isn’t the same as the string currently in audio_url.

BTW, I’m pretty sure

remove_action('save_post', 'save_url_link', 10, 2);

Doesn’t really to anything, since you’re already in that hook when you’re removing the hook from save_post. It won’t run twice, so no need to remove it.

tech