I run a multiple author platform with more than 1000 writers. Most users writer their content externally (Microsoft Word, OpenOffice etc) and paste it into the Visual Editor. Around 20% of the articles have a double space after every single period.
Feedback from the users tells me that some versions of these programs adds two spaces after full stop instead of one. I initially linked these users to tutorials of how to address this in the external application itself however the growth of the platform is making this a ridiculously exhausting task.
Is there a way to remove all double spaces and convert them into single space on the post page? Maybe upon clicking publish. It would be ideal if it happened on the backend post page rather than the front end (through some styling fix) – although I am open to ideas.
On a personal note, I find it quite astonishing that this feature is not a part of the core functions of WordPress given that at least 20% of my authors are experiencing it.
I cannot offer a JavaScript solution, because I am not sure where exactly this is happening.
But ⦠we can hook into
wp_insert_post_data
and solve this issue in PHP:As plugin on GitHub.
Add this to your
functions.php
fileThat should do the trick. Hope it helps!
Codex Page for Reference