Preserving line breaks when saving and displaying custom fields data

I stuck with the same question and actually tested wpautop(). It worked, e.g.

echo wpautop(get_post_meta($post->ID, '_aboutus', true));

Still, I came around one issue. When sanitizing the user input, don’t use a sanitization method that removed the line breaks before using wpautop 🙂

Leave a Comment