如何禁止wordpress url将`&`交换为`#038;`?
我想在wordpress中通过url传递一些值,但是我遇到了一些问题,wordpress会自动将&
交换为#038;
,如何制作& ;
仍然是 &
吗?
我注意到在wp-includes/formatting.php
中,有很多交换符号的规则,我尝试修改一些代码,但失败了。
某些链接(如
site.com?this=that&that=this
)将输出到 Web 浏览器地址(如 site.com?this=that#038that=this
)
和页面无法获取that=this
部分的值
如何正确设置?谢谢。
I want to pass some value through url in wordpress, but I met some trouble that wordpress will exchange &
to #038;
automatically, how to make a &
still as a &
?
I noticed in wp-includes/formatting.php
, there has many rules to exchange symbols, I tried modify some code, but failed.
some link like
site.com?this=that&that=this
will output to the web browser address like site.com?this=that#038that=this
and the page can not get the value in the part that=this
how to setting correctly? thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以通过将其添加到functions.php中来禁用wptexturize()文件放在模板文件夹中(或将其添加到现有文件夹中):
但请注意,这当然会禁用所有“清理”,而不仅仅是“&”转换。
如果您希望去掉 & 符号转换,您可以在formatting.php 中注释第 962 行。我在下面发布了第 961 和 962 行(这是来自未更改的 WP 3.1):
You can disable wptexturize() by adding this in a functions.php file inside your template folder (or add it to the existing one):
But note that this will of course disable all the "cleaning", not just the '&' conversion.
If you prefer to just get rid of the ampersand conversion you can comment line 962 in formatting.php. I post lines 961 and 962 bellow (this is from an unaltered WP 3.1):
我也遇到了这个问题,经过一番研究,我发现 这个插件 可以修复它。安装插件后,您只需在不希望 WordPress 格式化的代码周围添加这些标签即可。就像这样:
希望有帮助!
I also had this problem, after some research I found this plugin which fixes it. After installing the plugin you just add these tags around the piece of code you don't want wordpress to format. Like so:
Hope that helps!
另一个解决方案:
wp-includes\formatting.php
:在esc_url ()
注释该行它对我有用。
One More Solution:
wp-includes\formatting.php
: inesc_url ()
comment the lineIt works for me.