DISCLAIMER: this post is older than one year and may not be up to date with latest WordPress version.

How to be able to know if a specific post has an excerpt? It may seems hard at first because there’s no built-in WordPress function to achieve it, but I got this useful code which make it possible.

To check out if a post has an excerpt, simply paste the following code within the loop:

<?php if(!empty($post->post_excerpt)) {
     //This post have an excerpt, let's display it
     the_excerpt();
 } else {
     // This post have no excerpt
 } ?>

That’s all! Hope it helps!

Leave a Comment

Your email address will not be published. Required fields are marked *