get_the_excerpt() – Retrieves the post excerpt.

You appear to be a bot. Output may be restricted

Description

Retrieves the post excerpt.

Usage

$string = get_the_excerpt( $post );

Parameters

$post
( int|WP_Post ) optional – Optional. Post ID or WP_Post object. Default is global $post.

Returns

string Post excerpt.

Source

File name: wordpress/wp-includes/post-template.php
Lines:

1 to 25 of 25
function get_the_excerpt( $post = null ) {
  if ( is_bool( $post ) ) {
    _deprecated_argument( get_the_excerpt, '2.3.0' );
  }

  $post = get_post( $post );
  if ( empty( $post ) ) {
    return '';
  }

  if ( post_password_required( $post ) ) {
    return __( 'There is no excerpt because this is a protected post.' );
  }

  
/**
 * Filters the retrieved post excerpt.
 *
 * @since 1.2.0
 * @since 4.5.0 Introduced the `$post` parameter.
 *
 * @param string  $post_excerpt The post excerpt.
 * @param WP_Post $post         Post object.
 */
  return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
}
 

 View on GitHub View on Trac