如何通过Wordpress在URL中传递额外的变量 [英] How to pass extra variables in URL with Wordpress
问题描述
我无法将网址中的额外变量传递给我的wordpress安装。
例如 / news?c = 123
出于某种原因,它只能在网站的根目录 www.example.com?c=123
上运行,但如果url包含更多信息 www.example.com/news?c=123
。
if(isset($ _ GET ['c' ]))
{
setcookie(cCookie,$ _GET ['c']);
$ b $ if(isset($ _ SERVER ['HTTP_REFERER']))
{
setcookie(rCookie,$ _SERVER ['HTTP_REFERER']);
}
任何想法?
解决这个问题的方法很少。首先,如果你愿意的话,你可以选择一个插件:
或者手动设置代码,看看这个post:
另请参阅:
>I am having trouble trying to pass an extra variable in the url to my wordpress installation.
For example /news?c=123
For some reason, it works only on the website root www.example.com?c=123
but it does not work if the url contains any more information www.example.com/news?c=123
. I have the following code in my functions.php file in the theme directory.
if (isset($_GET['c']))
{
setcookie("cCookie", $_GET['c']);
}
if (isset($_SERVER['HTTP_REFERER']))
{
setcookie("rCookie", $_SERVER['HTTP_REFERER']);
}
Any Ideas?
There are quite few solutions to tackle this issue. First you can go for a plugin if you want:
Or code manually, check out this post:
Also check out:
这篇关于如何通过Wordpress在URL中传递额外的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!