title: WordPress - How to sanitize multi-line text from a textarea without losing line breaks?
body: <p>If I sanitize and save some meta text (called 'message') entered by the user like like this...</p>
  
  <pre><code>update_post_meta($post_id, 'message', sanitize_text_field($_POST['message']));
  </code></pre>
  
  <p>...and then retrieve and attempt to re-display the text like this...</p>
  
  <pre><code>echo '&lt;textarea id="message" name="message"&gt;' . esc_textarea( get_post_meta( $post-&gt;ID, 'message', true ) ) . '&lt;/textarea&gt;';
  </code></pre>
  
  <p>...all the line breaks get lost.</p>
  
  <p>In accordance with the WordPress codex, the line breaks are being stripped out by the sanitize_text_field() function. So how can I sanitize the text entered by the user without losing their line breaks?</p>