WP_REST_Revisions_Controller::prepare_excerpt_response() WordPress Method

The WP_REST_Revisions_Controller::prepare_excerpt_response() method is used to prepare the excerpt for a revision response. This includes setting the proper status code and header information.

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

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


Parameters

$excerpt

(string)(Required)The post excerpt.

$post

(WP_Post)(Required)Post revision object.


Top ↑

Return

(string) Prepared excerpt or empty string.


Top ↑

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


Top ↑

Changelog

Changelog
VersionDescription
4.7.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.