WordPress更改“&&"进入“&&" [英] Wordpress changing "&&" into "&&"

查看:44
本文介绍了WordPress更改“&&"进入“&&"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PHP include函数在我的Wordpress页面中包含静态 PHP JS 内容(可通过ezPHP插件实现)).PHP可以正常工作,而JS则不能.我收到非法字符"错误.每个&& 实例都被更改为&& 的html代码(我尝试在此处包括它,但它呈现了字符).为了尝试解决此问题,我(1)为我的用户禁用了Wordpress的WYSIWYG编辑器,(2)在 Settings > Writing 下,未选中"WordPress应该更正无效嵌套的XHTML自动",然后(3)将以下代码添加到主题的 function.php 中:

I'm using the PHP include function to include static PHP and JS content within my Wordpress pages (made possible with the ezPHP plugin). The PHP is working fine, but the JS isn't. I'm getting "illegal character" errors. Every instance of && is being changed to the html code for && (I tried including it here, but it renders the character). To try to fix this, I've (1) disabled Wordpress's WYSIWYG editor for my user, (2) under Settings > Writing, unchecked "WordPress should correct invalidly nested XHTML automatically", and (3) added the following code to my theme's function.php:

remove_filter('the_content', 'wpautop');
remove_filter('the_content', 'wptexturize');

仍然出现此错误.我猜想它与Wordpress的 esc_html()函数有关,但我不知道该怎么做.

Still I'm getting this error. I'm guessing it has something to do with Wordpress's esc_html() function, but I don't know how exactly.

推荐答案

您可以将javascript文件上传到另一个服务,然后通过添加HTML块将其从其中导入到Wordpress.

You can upload the javascript file to another service and import it to Wordpress from there by just adding an HTML block.

<script
   type="text/javascript"
   src="https://whatever-url-this-is/myjavascriptfile.js"
></script>

显然,Github不再支持该功能,但是在此处

Apparently, Github does not support that anymore, but there are some workarounds here and here.

这篇关于WordPress更改“&amp;&amp;"进入“&amp;#038;&amp;"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆