I am using the following code to generate a JSON feed. I need to extract the excerpt from posts, but when I run get_the_excerpt() it takes 28 seconds (yes SECONDS!) to run on my local server versus 599 milliseconds when I change get_the_excerpt() to 'hi'.
Does anybody have any idea why this is taking so long and what I can do to get it to load faster? This is on my local web server on the computer I'm using so it isn't due to a network issue.
$json = array();
while ( have_posts() ) {
the_post();
$yo = array('title' => get_the_title(), 'excerpt' => get_the_excerpt());
}
$json[] = $yo;
$json = json_encode($json);