• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WordPress core a2z

WordPress core a2z

WordPress core only

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / wp_get_referer() – Retrieve referer from ‘_wp_http_referer’ or HTTP referer.

You appear to be a bot. Output may be restricted

Description

Retrieve referer from '_wp_http_referer' or HTTP referer.

If it's the same as the current request URL, will return false.

Usage

$string|false = wp_get_referer();

Parameters

Returns

string|false Referer URL on success, false on failure.

Source

File name: wordpress/wp-includes/functions.php
Lines:

1 to 13 of 13
function wp_get_referer() {
  if ( ! function_exists( 'wp_validate_redirect' ) ) {
    return false;
  }

  $ref = wp_get_raw_referer();

  if ( $ref && wp_unslash( $_SERVER['REQUEST_URI'] ) !== $ref && home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) !== $ref ) {
    return wp_validate_redirect( $ref, false );
  }

  return false;
}
 

 View on GitHub View on Trac

Published: 25th November 2019 | Last updated: 2nd April 2020

Primary Sidebar

Information

Function name: wp_get_referer
Plugin ref: WordPress
Version: 5.6
Sourcefile: wp-includes/functions.php
File ref: wp-includes/functions.php
Deprecated?: No
API Letters: G,R,W

Footer

WP-a2z
WordPress core a2z
WordPress core only
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  core.wp-a2z.org
© Copyright WP-a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites