WP_REST_Revisions_Controller::prepare_excerpt_response()protectedWP 4.7.0

Checks the post excerpt and prepare it for single post output.

Method of the class: WP_REST_Revisions_Controller{}

Hooks from the method


String. Prepared excerpt or empty string.


// protected - for code of main (parent) or child class
$result = $this->prepare_excerpt_response( $excerpt, $post );
$excerpt(string) (required)
The post excerpt.
$post(WP_Post) (required)
Post revision object.


Since 4.7.0 Introduced.

WP_REST_Revisions_Controller::prepare_excerpt_response() code WP 6.3

protected function prepare_excerpt_response( $excerpt, $post ) {

	/** This filter is documented in wp-includes/post-template.php */
	$excerpt = apply_filters( 'the_excerpt', $excerpt, $post );

	if ( empty( $excerpt ) ) {
		return '';

	return $excerpt;