[wp-hackers] White space and the_excerpt

SoJ Web sojweb at indiana.edu
Fri Jul 10 13:33:45 UTC 2009


In case anyone else has happened across this:

I recently ran into a problem with the_excerpt(), where it would just  
output white space. It turned out that the posts it was doing that on  
had a bunch of HTML at the beginning, and when wp_trim_excerpt() ran,  
it was stripping the HTML tags, but leaving the surrounding white  
space. When it then pulled the first 55 words of the post content, it  
was all white space. To work around, I just put in some regex to  
collapse the white space before the excerpt was generated. Fix is  
here: http://core.trac.wordpress.org/ticket/10376


-Jeff Johnson


More information about the wp-hackers mailing list