Check if redirected from a specific page template

You can use the $_SERVER['HTTP_REFERER'] to check the page where it redirected from

You can use it as below.

if($_SERVER['HTTP_REFERER'] == "path-of-page-you-want-to-check"){
//Do something here
}

Conditionally you can call functions like is_home(), is_front_page() to run that block of code in homepage only

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)