WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Filter Reference/get the guid

Description

The "get_the_guid" filter is used to filter the guid of the post after it is retrieved from the database and before it is returned from the get_the_guid() function.

Usage

When the 'get_the_guid' filter is called, it is passed a single argument containing the post guid.

function filter_function_name( $guid ) {
  # ...
}
add_filter( 'get_the_guid', 'filter_function_name' );

Where 'filter_function_name' is the function WordPress should call when the guid is being retrieved. Note that the filter function must return the guid after it is finished processing, or any code using the guid (for example: RSS feeds) will break, and other plugins also filtering the guid may generate errors.

filter_function_name should be unique function name. It cannot match any other function name already declared.

See Also