Skip to main content
Added example function.
Source Link
Milan Petrovic
  • 1.9k
  • 2
  • 14
  • 17

WordPress has a function that can extract referrer information (website where user originated from): wp_get_referer().

It will return URL from the originating website. If that is not available it will return FALSE.

This is the simple example PHP function that will display welcome message when called, if the referrer is set:

function wse_280729_show_welcome_message() {
  $ref = wp_get_referer();

  if ($ref) {
    echo "Welcome visitor from '$ref'.";
  }
}

How will you use this is up to you, and depends where you want to display this, and will involve some theme modification and calling this function to show the message (if referrer is set).

WordPress has a function that can extract referrer information (website where user originated from): wp_get_referer().

It will return URL from the originating website. If that is not available it will return FALSE.

WordPress has a function that can extract referrer information (website where user originated from): wp_get_referer().

It will return URL from the originating website. If that is not available it will return FALSE.

This is the simple example PHP function that will display welcome message when called, if the referrer is set:

function wse_280729_show_welcome_message() {
  $ref = wp_get_referer();

  if ($ref) {
    echo "Welcome visitor from '$ref'.";
  }
}

How will you use this is up to you, and depends where you want to display this, and will involve some theme modification and calling this function to show the message (if referrer is set).

added 10 characters in body
Source Link
Johansson
  • 15.4k
  • 11
  • 43
  • 79

WordPress has a function that can extract referrer information (website where user originated from): wp_get_refererwp_get_referer(). 

It will return URL from the originating website. If that is not available it will return FALSEFALSE.

WordPress has a function that can extract referrer information (website where user originated from): wp_get_referer. It will return URL from the originating website. If that is not available it will return FALSE.

WordPress has a function that can extract referrer information (website where user originated from): wp_get_referer(). 

It will return URL from the originating website. If that is not available it will return FALSE.

Source Link
Milan Petrovic
  • 1.9k
  • 2
  • 14
  • 17

WordPress has a function that can extract referrer information (website where user originated from): wp_get_referer. It will return URL from the originating website. If that is not available it will return FALSE.