has_excerpt

Whether post has excerpt.

Description

has_excerpt( (int) $id = 0 ); 

Parameters (1)

0. $id — Optional. (int)
Post ID or post object.

Usage

  1. if ( !function_exists( 'has_excerpt' ) ) { 
  2. require_once ABSPATH . WPINC . '/post-template.php'; 
  3.  
  4. // Optional. Post ID or post object. 
  5. $id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = has_excerpt($id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post-template.php  
  1. function has_excerpt( $id = 0 ) { 
  2. $post = get_post( $id ); 
  3. return ( !empty( $post->post_excerpt ) );