Need help removing whitespace from end of Wordpress post as it's saved
Posted on 2014-01-28
I'm surprised this is not more of an issue on multi-author blogs. Certainly is with my writers -
They tend to leave extra <p></p> tags at the end of their posts, not realizing that white space (when viewed on the visual editor) is going to appear as empty space on their post when published.
To complicate it a bit, sometimes, depending on how they edited it, there will be styles in the tag, such as: <p style="text-align: justify;"></p>.
Is there a way to identify and trim all empty paragraph tags from the end of the post as it's being saved?
Thanks for any assistance,
edit - its occurred to me that I don't need to trim paragraphs only from the - end - of the post. I don't see any reason for any empty paragraph tags to exist in the content at all. So the solution could remove all empty p tags, not just the ones at the end. That would probably be easier.