Languages: English • Italiano • 日本語 (Add your language)
Whether the current post has a custom excerpt.
<?php has_excerpt( $id ); ?>
<?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 } ?>
Since: 2.3.0
has_excerpt() is located in wp-includes/post-template.php
.