On this page
wp_referer_field( bool $echo = 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
$echobool 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( $echo = true ) {
$request_url = remove_query_arg( '_wp_http_referer' );
$referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_url( $request_url ) . '" />';
if ( $echo ) {
echo $referer_field;
}
return $referer_field;
}
Related
Uses
| Uses | Description |
|---|---|
| remove_query_arg() wp-includes/functions.php | Removes an item or items from a query string. |
| esc_url() wp-includes/formatting.php | Checks and cleans a URL. |
Used By
| Used By | Description |
|---|---|
| WP_Plugin_Install_List_Table::display_tablenav() wp-admin/includes/class-wp-plugin-install-list-table.php | |
| wp_nonce_field() wp-includes/functions.php | Retrieves or display nonce hidden field for forms. |
Changelog
| Version | Description |
|---|---|
| 2.0.4 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_referer_field