Created
November 28, 2012 18:02
-
-
Save plasticmind/4162908 to your computer and use it in GitHub Desktop.
Remove the second space after a period in WordPress posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See: http://www.jetmore.org/john/blog/2012/03/multiple-spaces-after-period-in-wordpress/ | |
function gist_kill_double_space( $content ) { | |
if ( seems_utf8( $content ) ) { | |
$clean_content = preg_replace( '/[\p{Z}\s]{2,}/u', ' ', $content ); | |
} else { | |
$clean_content = preg_replace( '/\s\s+/', ' ', $content ); | |
} | |
return $clean_content; | |
} | |
add_filter( 'the_content', 'gist_kill_double_space' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment