I’m trying to write an if statement based on the url of the previously click page_id
Something like this:
<?php
$page_id = " the id or url of the page clicked to get to this page"
if($page_id){
jr_register_form_jseeker( $redirect, $role );
}else{
jr_register_form( $redirect, $role );
}
?>
I’ve looked at is_page()
but that only seems to deal with the current page…?
Any ideas..?
Thanks
You can use
wp_get_referer()
. Read more about in documentation.Or just call to:
$_SERVER['HTTP_REFERER']
.There is no wordpress function that returns the id of the previous page. However, you can use
$_SERVER['HTTP_REFERER']
. It should contain the ID of the previous page as a parameter. In combination withparse_url
andparse_str
you should be able to get the ID:(Not tested)