Is there any method to get the previous page /refer page url in wordpress.

In my wordpress site there is a paypal form it include return url . So after payment complete it come back to the site. Now i need to check this page is returned from paypal website, not the user manually taken this page.

How to check this? Is there any function?

Any suggestions?

  • You can use this approach. There are also some valuable links you need to check out in the linked post. The method described in the linked post is far more reliable than wp_get_referer() ;-) Jul 15, 2015 at 5:37

1 Answer 1


function will give you a referrer page URL. codex documentation here

  • You know this is extremely unreliable. It will not work if referers on client side is disabled or when a client is behind a proxy Jul 15, 2015 at 5:31
  • The REFERER is sent by the client's browser as part of the HTTP protocol and is, therefore, unreliable indeed. But @ron r wants the referrer URL just to check that direct access of a page.
    – Domain
    Jul 15, 2015 at 5:39
  • but not working when it is redirected from palypal .It work within the site.
    – ron r
    Jul 15, 2015 at 5:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.