<?php // Get $post if you're inside a function global $post; if ( has_excerpt( $post->ID ) ) { // This post has excerpt } else { // This post has no excerpt } ?>
Other Use
When you need to hide the auto displayed excerpt and only display your post’s excerpts.
<?php if ( ! has_excerpt() ) { echo ''; } else { the_excerpt(); }
Replace auto excerpt for a text or code.
<?php if ( ! has_excerpt() ) {?> <!-- you text or code --> <?php } ?>