get_the_guid

Filters the Global Unique Identifier (guid) of the post.

Description

apply_filters( 'get_the_guid', (string) $guid, (int) $id ); 

Parameters (2)

0. $guid (string)
Global Unique Identifier (guid) of the post.
1. $id (int)
The post ID.

Usage

To run the hook, copy the example below.
  1. $guid = apply_filters( 'get_the_guid', $guid, $id ); 
  2.  
  3. if ( !empty( $guid ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the get_the_guid callback 
  2. function filter_get_the_guid( $guid, $id ) { 
  3. // make filter magic happen here... 
  4. return $guid
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'get_the_guid', 'filter_get_the_guid', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'get_the_guid', 'filter_get_the_guid', 10, 2 ); 

Defined (3)

The filter is defined in the following location(s).

/wp-includes/post-template.php  
  1. return apply_filters( 'get_the_guid', $guid, $id ); 
/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php  
  1. 'rendered' => apply_filters( 'get_the_guid', $post->guid ), 
/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php  
  1. 'rendered' => apply_filters( 'get_the_guid', $post->guid ),