Hello everyone, I have a question that I hope can be guided and answered.
My website is made with WordPress and has a shortcode that looks like this
`[promotion]`
I want to check if the user accesses from Google search and displays the short code above.
If false don’t display it
Currently I have tried checking the http referrer with the following code:
`<?php`
`// Check if Referral URL exists`
`if (isset($_SERVER[‘HTTP_REFERER’])) {`
`// Store Referral URL in a variable`
`$refURL = $_SERVER[‘HTTP_REFERER’];`
`// Display the Referral URL on web page`
`echo $refURL;`
`} else {`
`echo “No referer URL”;`
`}`
`?>`
But it only checks the referrer from Google which is OK. I want it to check if the correct user from Google search then displays the short code **\[promotion\]**. Otherwise, the short code will not be displayed.
Can AI help me do this?
Regards.
Toi Duy
[ad_2]