admin管理员组文章数量:1122832
I have a page template, which redirects to the homepage using this:
wp_redirect( home_url() );
Now, on the homepage is it possible to check if it has been redirected from a specific page template without knowing the URL of that page?
I have a page template, which redirects to the homepage using this:
wp_redirect( home_url() );
Now, on the homepage is it possible to check if it has been redirected from a specific page template without knowing the URL of that page?
Share Improve this question asked Dec 16, 2014 at 10:05 jayjay 11 bronze badge 1- possible duplicate of Get default permalink structure from pretty URL's – Pieter Goosen Commented Dec 16, 2014 at 11:47
1 Answer
Reset to default 0You 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
本文标签: theme developmentCheck if redirected from a specific page template
版权声明:本文标题:theme development - Check if redirected from a specific page template 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736280991a1926175.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论