Loop through posts? Want to remove extra newlines in actual post HTML/content on backend

I have a ton of posts that we created, but unfortunately there are a lot of blank spaces. This is an example of what I see on the backend, in the actual post:

This is a post title

    Words here. More words.     Words down here.

So, when that is rendered on the page on the Front end, there are extra line breaks that I’d like to get rid of.

Is there a way to loop through the actual posts on the backend? Then I can (somehow) check for 2+ empty lines and/or  , and remove them.

Or – a solution to the symptom, not the problem – would I be better off somehow using CSS to remove such lines?

Leave a Reply

Your email address will not be published. Required fields are marked *