Skip to content

Instantly share code, notes, and snippets.

@runezero
Created June 7, 2022 11:57
Show Gist options
  • Select an option

  • Save runezero/84cc684923214d84844840ea24404282 to your computer and use it in GitHub Desktop.

Select an option

Save runezero/84cc684923214d84844840ea24404282 to your computer and use it in GitHub Desktop.
[Get referrer url] Get the referrer url and previous page id from the current page parameters #wordpress
<?php
//get the referrer url
wp_get_referer()
//get the post_id from the referrer url
url_to_postid(wp_get_referer());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment