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).
Related Posts:
- Best Practice for PHP
- Adding “Remember Me” in custom login
- Using wp_send_json to return HTML
- WordPress URL Rewrite not working
- Add post class to the TinyMCE iframe?
- How to remove a metabox from menu editor page?
- How to Join two tables from separate databases within WordPress
- How to find objects by terms
- Bypass .htaccess when using download_url
- wp_remote_get returns an error for valid URL
- Install will not load: PHP does not have MYSQL installed
- Constructing a custom login form using ajax
- Error when requesting password reset email – wp authentication
- How to do conditional publishing?
- New Plugin Review
- Create custom blocks for bootstrap
- How to get the post_id from postmeta
- Anyone can register via backend
- How to get to a specific position in wp_query?
- Preferred Method of debugging a wordpress SQL calls?
- Taxonomy linked to pages
- Checking for new message using AJAX and PHP. Server overload?
- WordPress Scheduled Event Request Blocking
- jQuery not defined
- dynamic page in WordPress
- Is it acceptable to treat a filter like an action?
- Multiple options not staying selected after saving
- Where to place PHP code that inserts (or doesn’t insert) menu item?
- Fetch post block/field data as JSON with WordPress API
- How to design a table based on css values set from admin/dashboard
- Get the post ID and display the images
- Where to find documentation for CPT block template? (PHP)
- Sort the result of the main Query in shop page by a custom taxonomy
- WP Post-Thumbnail
- Responsive Header for Phone
- Programmatic Login from 3rd Party site
- Save Search System
- Media upload ERROR Message Showing in BOTTOM of the page wordpress
- Setting default category base on theme activation
- parts of url disappear when using # inside href=”” [closed]
- Help with Sub and Sub-Sub Navigation
- How to manually change current date to post date in frontend?
- WordPress Woocommerce – Product Type [closed]
- WordPress installation permission errors
- Custom field values to taxonomy terms
- Why does wp_head hook my functions to the beginning of my source code?
- Noscript not working as it should in wordpress site
- Pass argument to event hook
- Translate wordpress date from Italian to English
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- wp_insert_post: array only. wp_update_post: array|object (?)
- What is the difference in the WP memory limits?
- Removing the comment function within wordpress
- Content filter won’t work
- How to retrive the text : No movie by this actor
- Is the 404 page automatically displayed if a loop returns nothing?
- Get related product based on subcategory selected from category id with ID 142
- Bootstrap Carousel HTML structure and funny output [closed]
- How to remove custom style from source?
- Customizer: How to change Header Image description
- How to add post classes?
- PHP Helper Class to create shortcodes
- Extract and display user infromation on an automatically created page
- Why won’t this wpdb get_results query return results?
- Why doesn’t global $wp_query not get hooked?
- Is it legal to redefine wp_password_change_notification in a mu plugin?
- How can I assign separate stylesheets to different pages?
- Using multiple variables to assign categories to an array
- Show Custom Menu Name in WordPress 3
- Add a custom WooCommerce settings tab with sections
- Checking page before applying image restrictions while uploading
- AWS Lightsail WordPress – connect to database on instance using mysqli
- Create category after theme setup and modify the default one
- PHP error on local server install
- how to use 2 index.php file One for mobile and one for desktop
- Accordion headings cuts off to second line on collapsing a accordion heading (used acf repeater)
- Using $this with an anonymous function in filters
- Dynamic_sidebar load in string makeup
- Post Meta statement?
- Prepared DB Query from _POST array
- How to include non-users in wp-admin redirect?
- Add disclaimer before certain posts and pages
- Use Custiomizer to setup meta theme color tag
- Static home page ignored
- How do I routinely extract the thumbnail of the most recent post?
- Click to expand menu
- WP_Post is not from correct array
- Showing custom field contents without listing description
- Using ‘array’ method in wp_nav_menu causes it to disappear
- If I define a variable in header.php, how do I make it available to templates?
- How to add together (get the sum) a field from all author’s posts
- two body tags on all WP pages regardless of theme
- Display biography post for today’s birthday person
- WordPress 6.1.1 UTF8 Slug Limit Increase
- WordPress directories not writable after PHP version upgrade
- How do I unset category from a product in wordpress by code
- How to change wp-admin and wp-login urls
- add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico
- Load style and script for custom post type metabox
- Permissions error when I use my plugin to delete comments in the front-end