get_the_excerpt filter-hookWP 1.2.0

Filters the retrieved post excerpt.

Usage

add_filter( 'get_the_excerpt', 'wp_kama_get_the_excerpt_filter', 10, 2 );

/**
 * Function for `get_the_excerpt` filter-hook.
 * 
 * @param string  $post_excerpt The post excerpt.
 * @param WP_Post $post         Post object.
 *
 * @return string
 */
function wp_kama_get_the_excerpt_filter( $post_excerpt, $post ){

	// filter...
	return $post_excerpt;
}
$post_excerpt(string)
The post excerpt.
$post(WP_Post)
Post object.

Changelog

Since 1.2.0 Introduced.
Since 4.5.0 Introduced the $post parameter.

Where the hook is called

get_the_excerpt()
get_the_excerpt
WP_REST_Posts_Controller::prepare_item_for_response()
get_the_excerpt
WP_REST_Attachments_Controller::prepare_item_for_response()
get_the_excerpt
wp-includes/post-template.php 429
return apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php 1822
$excerpt = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );
wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php 741
$caption = apply_filters( 'get_the_excerpt', $post->post_excerpt, $post );

Where the hook is used in WordPress

wp-includes/default-filters.php 200
add_filter( 'get_the_excerpt', 'wp_trim_excerpt', 10, 2 );