the_content
Filter HookDescription
Prepares the revision for the REST response.Hook Information
File Location |
wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
View on GitHub
|
Hook Type | Filter |
Line Number | 652 |
Hook Parameters
Type | Name | Description |
---|---|---|
WP_Post
|
$item
|
Post revision object. |
WP_REST_Request
|
$request
|
Request object. |
Usage Examples
Basic Usage
<?php
// Hook into the_content
add_filter('the_content', 'my_custom_filter', 10, 2);
function my_custom_filter($item, $request) {
// Your custom filtering logic here
return $item;
}
Source Code Context
wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php:652
- How this hook is used in WordPress core
<?php
647 if ( in_array( 'content', $fields, true ) ) {
648
649 $data['content'] = array(
650 'raw' => $post->post_content,
651 /** This filter is documented in wp-includes/post-template.php */
652 'rendered' => apply_filters( 'the_content', $post->post_content ),
653 );
654 }
655
656 if ( in_array( 'excerpt', $fields, true ) ) {
657 $data['excerpt'] = array(
PHP Documentation
<?php
/**
* Prepares the revision for the REST response.
*
* @since 4.7.0
* @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
*
* @global WP_Post $post Global post object.
*
* @param WP_Post $item Post revision object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php
Related Hooks
Related hooks will be displayed here in future updates.