W3cubDocs

/WordPress

WP_REST_Revisions_Controller::prepare_excerpt_response( string $excerpt, WP_Post $post )

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

Description

Parameters

$excerpt

(string) (Required) The post excerpt.

$post

(WP_Post) (Required) Post revision object.

Return

(string) Prepared excerpt or empty string.

Source

File: wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php

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;
	}

Changelog

Version Description
4.7.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_rest_revisions_controller/prepare_excerpt_response