WordPress Hooks Explorer

Listing all hooks extracted WordPress Core


Details about get_the_guid

Back to home

Files

Filename Hook Type Line Number PHP Doc
wp-includes/post-template.php apply_filters 234 /**
* Filters the Global Unique Identifier (guid) of the post.
*
* @since 1.5.0
*
* @param string $post_guid Global Unique Identifier (guid) of the post.
* @param int $post_id The post ID.
*/
wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php apply_filters 1782 /**
* Prepares a single post output for response.
*
* @since 4.7.0
* @since 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.
*
* @param WP_Post $item Post object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/
public function prepare_item_for_response( $item, $request ) {
// Restores the more descriptive, specific name for use within this method.
$post = $item;
$GLOBALS['post'] = $post;

setup_postdata( $post );

$fields = $this->get_fields_for_response( $request );

// Base fields for every post.
$data = array();

if ( rest_is_field_included( 'id', $fields ) ) {
$data['id'] = $post->ID;
}

if ( rest_is_field_included( 'date', $fields ) ) {
$data['date'] = $this->prepare_date_response( $post->post_date_gmt, $post->post_date );
}

if ( rest_is_field_included( 'date_gmt', $fields ) ) {
/*
* For drafts, `post_date_gmt` may not be set, indicating that the date
* of the draft should be updated each time it is saved (see #38883).
* In this case, shim the value based on the `post_date` field
* with the site's timezone offset applied.
*/
wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php apply_filters 590 /**
* 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.
*
* @param WP_Post $item Post revision object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response Response object.
*/

Hook Parameters

Parameter Type Name Description
string $post_guid Global Unique Identifier (guid) of the post.
int $post_id The post ID.