Hello,
I am trying to remove all multiple white spaces from get_content();
But in my html post editor I just have some extra white spaces, and there are no <strong> </strong> characters, but in the output of the <strong>get_the_content</strong>, there additional   replacing the additional white space.
So I tried this...
<?php
$termsConditions = str_replace(' '," ",get_the_content());
echo preg_replace('/\s+/',' ',$termsConditions);
?>
But still there are multiple  
are in my text.
How are these being generated? or why is my php above not working?
Can anyone help please.
Thanks
Francisco Javier Carazo Gil answers:
With this you can clean every HTML special character: $Content = preg_replace("/&#?[a-z0-9]{2,8};/i","",$Content);
Francisco Javier Carazo Gil comments:
And this I think is better for you:
$string = htmlentities($string, null, 'utf-8');
$string = str_replace(" ", "", $string);
Josh Cranwell comments:
Thanks dude, the second bit worked.
Nice one.
Francisco Javier Carazo Gil comments:
Perfect!
daas answers:
$content = preg_replace( '/\s+/', ' ', get_the_content() );
echo $content;
It should work :)
<strong>Edit</strong>
or use this if it is non-breaking space
$content = str_replace(' '," ",get_the_content());
$content = preg_replace( '/\s+/', ' ', $content );
echo $content;
Josh Cranwell comments:
Thanks for your answer tho the answer above worked for me. Thanks