header.php 文件在地址栏中的 URL 末尾生成随机字符串
我正在开发一个经过大量重新设计的 WordPress 主题,包括布局、模板和功能,由于某种原因,header.php 文件现在生成一个随机字符串,并将其附加到我域上的每个 URL 上的哈希标记后,如下所示:
http://www.pixelsandtea.com/#axzz1ZvQRmIcj
我已经缩小了范围通过停用所有插件将问题归咎于头文件,当我将 header.php 文件恢复为原始文件时,它不再执行此操作。我只是想知道是否有人知道类似的问题以及可能的原因是什么,以便我可以保留重新设计的标题并修复该问题。
谢谢
I'm developing a heavily redesigned a WordPress theme, including layout, templates and functions and for some reason the header.php file is now generating a random string and appending it to every URL on my domain after a hash tag like this:
http://www.pixelsandtea.com/#axzz1ZvQRmIcj
I've narrowed down the problem to the header file by deactivating all plugins, and when I reverted the header.php file back to the original it didn't do it anymore. I'd just like to know if anybody's aware of a similar problem and what might be the cause so I can keep my redesigned header with a fix for the problem.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我对这个问题感到非常害怕和困惑,结果发现它是由“AddThis”代码引起的。
如果您在获取代码时选中“跟踪地址栏共享”选项,则会发生这种情况。如果取消选中它,问题就解决了。
顺便说一句,默认情况下它是未选中的,我已经选中了它。
I was so freaked out and perplexed by this problem and it turned out to be being caused by the 'AddThis' code.
If you check the option "Track address bar shares" while getting the code, this happens. If you uncheck it the problem is solved.
BTW it is unchecked by default and I had checked it.
它不是 PHP;而是 PHP。这是 javascript - 你肯定注意到了,当 javascript 关闭时,它不会发生。
在您使用的大量 js 文件中查找
window.location.hash
的一些实例。有很多,但提示:您正在寻找的那个不在 jQuery.js 中。其他提示:与内部锚点有很大关系的 javascript 文件是什么?
It's not PHP; it's javascript - you surely noticed how, with javascript turned off, it does not happen.
Look for some instances of
window.location.hash
in the plethora of js files you're using. There's quite a few but hint: the one you're looking for is not in jQuery.js.Other hint: wht's that javascript file that has a lot to do with internal anchors?