WordPress Excerpts Empty but Post Has Content
After running the WordPress export/import tool to move a blog, I noticed the excerpts were not showing up on the blog archive pages. Usually, WordPress will auto-generate an excerpt for posts if a custom excerpt does not exist. The problem was that the export/import tools were leaving whitespace characters (tabs, spaces, line breaks) in the post_excerpt fields in the database. Then, when WordPress later tried to generate an excerpt, it saw that the field was not empty and assumed it was a custom excerpt.
To fix this, I added a custom filter to my theme’s functions.php file. This filter runs before the WordPress filter that auto-generates excerpts, and strips out any leading or trailing whitespace before passing along to WordPress:
One comment on “WordPress Excerpts Empty but Post Has Content”
Thanks for the code .. it works like magic, bring all the post excerpt back after I reload my site