[英]Wordpress passing query parameters from page to page
I would like to pass query string parameters from one page to another in wordpress. 我想在wordpress中将查询字符串参数从一页传递到另一页。 The problem im facing is wordpress always removes the ?get queries everytime a new page loads - hence there's no way i can pass the parameters. 我面临的问题是,WordPress总是在每次加载新页面时都删除?get查询-因此,我无法传递参数。
Ideal flow ==> 理想流量==>
Affiliate sends traffic to my domain using link: 会员使用链接将流量发送到我的域:
http://domain.com/pricing/?id=123&no=456 http://domain.com/pricing/?id=123&no=456
User lands on this website and starts reading. 用户登陆该网站并开始阅读。 User then decides to navigate to eg the "about-us" section by clicking somewhere on the page's menu. 然后,用户决定通过单击页面菜单上的某个位置来导航至“关于我们”部分。
User then gets redirected to domain.com/about-us 然后,用户被重定向到domain.com/about-us
[(query string parameters) got stripped!] [(查询字符串参数)被剥夺了!]
What can I do to make sure the query parameters stay? 如何确保查询参数保持不变?
What can i do to get the user redirected to domain.com/about-us/?id=123&no=456 ? 我该怎么做才能使用户重定向到domain.com/about-us/?id=123&no=456?
In general, I wish that the whole query string "?id=123&no=456" can be passed from one page to another, until user closes the window. 通常,我希望整个查询字符串“?id = 123&no = 456”可以从一页传递到另一页,直到用户关闭窗口为止。
I'm trying to be as clear as I can but I apologise if I'm not explaning too well on this! 我正尽力澄清自己的意思,但如果对此解释得不太清楚,我深表歉意!
Appreciate if anyone can lend a helping hand! 感谢任何人都可以伸出援手! all forms (keep it simple please) of answers will be appreciated! 所有形式的答案(请保持简单)将不胜感激!
Add this to your functions.php: 将此添加到您的functions.php中:
function append_query_string($url) {
return add_query_arg($_GET, $url);
}
add_filter('the_permalink', 'append_query_string');
https://codex.wordpress.org/Plugin_API/Filter_Reference/the_permalink https://codex.wordpress.org/Plugin_API/Filter_Reference/the_permalink
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.