简体   繁体   English

在帖子的可视编辑器中删除了Wordpress javascript参数

[英]Wordpress javascript parameters removed in Visual editor of posts

I use WordPress 4.5.3. 我使用WordPress 4.5.3。 I want to add the following script to my post: 我想在我的帖子中添加以下脚本:

   <script src='/free/load.js' lang='en' size='p' kind='m'></script>

I add the script when I am on the "Text" tab on the Edit a post page. 当我在“编辑帖子”页面的“文本”选项卡上时,添加脚本。 When I go to the Visual tab and then back to the Text tab, the last part of the script is removed and it looks like this: 当我转到“视觉”选项卡,然后回到“文本”选项卡时,脚本的最后一部分被删除,看起来像这样:

   <script src='/free/load.js'></script>

Sometimes the parameters passed to the script may need to be changed, so I cannot allow to have them removed. 有时可能需要更改传递给脚本的参数,所以我不允许删除它们。

I read that in WordPress 2 there is an option to disable Rich editor, however in 4.5.3 I see only the option "Disable the visual editor when writing" under User's Profile options. 我读到WordPress 2中有一个禁用Rich编辑器的选项,但是在4.5.3中,我仅在“用户的个人资料”选项下看到“在编写时禁用可视编辑器”选项。 This removes the whole Visual editor which I do not want. 这将删除整个我不需要的可视编辑器。

Probably better to create yourself a shortcode that loads the js file with the parameters passed to the shortcode tag. 可能最好自己创建一个简短代码,以使用传递给shortcode标记的参数加载js文件。

Or if the script is in every post add custom fields to the post for the script params. 或者,如果脚本在每个帖子中都存在,则将自定义字段添加到脚本参数的帖子中。 Little more user friendly as well. 以及更多的用户友好。

https://codex.wordpress.org/Shortcode_API https://codex.wordpress.org/Shortcode_API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM