Filter hook 'get_the_guid'

in WP Core File wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php at line 635

View Source

get_the_guid

Filter Hook
Description
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 635

Hook Parameters

Type Name Description
WP_Post $item Post revision object.
WP_REST_Request $request Request object.

Usage Examples

Basic Usage
<?php
// Hook into get_the_guid
add_filter('get_the_guid', '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:635 - How this hook is used in WordPress core
<?php
 630  		}
 631  
 632  		if ( in_array( 'guid', $fields, true ) ) {
 633  			$data['guid'] = array(
 634  				/** This filter is documented in wp-includes/post-template.php */
 635  				'rendered' => apply_filters( 'get_the_guid', $post->guid, $post->ID ),
 636  				'raw'      => $post->guid,
 637  			);
 638  		}
 639  
 640  		if ( in_array( 'title', $fields, true ) ) {

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.