Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Commit

Permalink
Return null if post doesn't have an excerpt. Fixes #72.
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelbaker committed Mar 21, 2014
1 parent 04e4672 commit 83e45c4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/class-wp-json-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,7 +606,11 @@ protected function prepare_excerpt( $excerpt ) {
return __( 'There is no excerpt because this is a protected post.' );
}

return apply_filters( 'the_excerpt', apply_filters( 'get_the_excerpt', $excerpt ) );
$excerpt = apply_filters( 'the_excerpt', apply_filters( 'get_the_excerpt', $excerpt ) );
if ( empty( $excerpt ) ) {
return null;
}
return $excerpt;
}

/**
Expand Down

0 comments on commit 83e45c4

Please sign in to comment.