我试过用
$_GET['glossary']
在 wordpress functions.php 中隐藏以下域的特定帖子的特定路径
https://sampledomain.com?glossary=extrathing
完整代码如下
if ($_GET['glossary']){
printf('<style>.author-box{display:none;}</style>');
}
它完美地工作并隐藏了特定帖子的作者框。
然而,当我在 wordpress 中激活永久链接时,将 url 更改为
https://sampledomain.com/glossary/extrathing/
$_GET 的上述功能不再有效,请问有什么建议吗?
最佳答案
您可以更改 if 条件以检查 uri
if ($_GET['glossary'] || $_SERVER['REQUEST_URI'] == '/glossary/extrathing/'){
printf('<style>.author-box{display:none;}</style>');
}
关于php - 如何使 $_GET 函数与重写的 url 一起工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34820091/