How To Get the URL of the page you are on with PHP
I’ve built a little custom “send to a friend” pop-up where someone can enter their name and the email of a friend and send them a message about a particular post. I want to automatically include a link to the page they are on in the email, but I’m having trouble figuring out how to grab the url for the page they are on. Is there a WordPress function to do this? I tried using the basic PHP function echo $_SERVER[‘PHP_SELF’] which usually returns the page you are on, but it just seems to return index in this case. Any help would be greatly appreciate. Thanks much!
- The topic ‘How To Get the URL of the page you are on with PHP’ is closed to new replies.