Title: wp_original_referer_field
Published: April 25, 2014
Last modified: May 20, 2026

---

# wp_original_referer_field( bool $display = true, string $jump_back_to = 'current' ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#wp--skip-link--target)

Retrieves or displays original referer hidden field for forms.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#description)󠁿

The input name is ‘_wp_original_http_referer’ and will be either the same value 
of [wp_referer_field()](https://developer.wordpress.org/reference/functions/wp_referer_field/),
if that was posted already or it will be the current page, if it doesn’t exist.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#parameters)󠁿

 `$display`booloptional

Whether to echo the original http referer.

Default:`true`

`$jump_back_to`stringoptional

Can be `'previous'` or page you want to jump back to.
 Default `'current'`.

Default:`'current'`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#return)󠁿

 string Original referer field.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#source)󠁿

    ```php
    function wp_original_referer_field( $display = 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 ( $display ) {
    		echo $orig_referer_field;
    	}

    	return $orig_referer_field;
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/functions.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/functions.php#L1950)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/functions.php#L1950-L1964)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_get_original_referer()](https://developer.wordpress.org/reference/functions/wp_get_original_referer/)`wp-includes/functions.php` |

Retrieves original referer that was posted, if it exists.

  | 
| [wp_get_referer()](https://developer.wordpress.org/reference/functions/wp_get_referer/)`wp-includes/functions.php` |

Retrieves referer from ‘_wp_http_referer’ or HTTP referer.

  | 
| [wp_unslash()](https://developer.wordpress.org/reference/functions/wp_unslash/)`wp-includes/formatting.php` |

Removes slashes from a string or recursively removes slashes from strings within an array.

  | 
| [esc_attr()](https://developer.wordpress.org/reference/functions/esc_attr/)`wp-includes/formatting.php` |

Escaping for HTML attributes.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#)

| Used by | Description | 
| [the_block_editor_meta_box_post_form_hidden_fields()](https://developer.wordpress.org/reference/functions/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](https://developer.wordpress.org/reference/functions/wp_original_referer_field/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.0.4](https://developer.wordpress.org/reference/since/2.0.4/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_original_referer_field%2F)
before being able to contribute a note or feedback.