On this page
wp_original_referer_field( bool $echo = true, string $jump_back_to = 'current' ): string
Retrieves or displays original referer hidden field for forms.
Description
The input name is ‘_wp_original_http_referer’ and will be either the same value of wp_referer_field() , if that was posted already or it will be the current page, if it doesn’t exist.
Parameters
$echobool Optional-
Whether to echo the original http referer.
Default:
true $jump_back_tostring Optional-
Can be
'previous'or page you want to jump back to.
Default'current'.Default:
'current'
Return
string Original referer field.
Source
File: wp-includes/functions.php. View all references
function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
$ref = wp_get_original_referer();
if ( ! $ref ) {
$ref = ( 'previous' === $jump_back_to ) ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
}
$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
if ( $echo ) {
echo $orig_referer_field;
}
return $orig_referer_field;
}
Related
Uses
| Uses | Description |
|---|---|
| wp_get_original_referer() wp-includes/functions.php | Retrieves original referer that was posted, if it exists. |
| wp_get_referer() wp-includes/functions.php | Retrieves referer from ‘_wp_http_referer’ or HTTP referer. |
| wp_unslash() wp-includes/formatting.php | Removes slashes from a string or recursively removes slashes from strings within an array. |
| esc_attr() wp-includes/formatting.php | Escaping for HTML attributes. |
Used By
| Used By | Description |
|---|---|
| the_block_editor_meta_box_post_form_hidden_fields() wp-admin/includes/post.php | Renders the hidden form required for the meta boxes form. |
Changelog
| Version | Description |
|---|---|
| 2.0.4 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_original_referer_field