wp_referer_field( bool $display = true ): string
Retrieves or displays referer hidden field for forms.
Description
The referer link is the current Request URI from the server super global. The input name is ‘_wp_http_referer’, in case you wanted to check manually.
Parameters
-
$display
bool Optional -
Whether to echo or return the referer field.
Default:
true
Return
string Referer field HTML markup.
Source
File: wp-includes/functions.php
.
View all references
function wp_referer_field( $display = true ) {
$request_url = remove_query_arg( '_wp_http_referer' );
$referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_url( $request_url ) . '" />';
if ( $display ) {
echo $referer_field;
}
return $referer_field;
}
Changelog
Version | Description |
---|---|
2.0.4 | Introduced. |