Attempting to display javascript on the syntaxhighlight of the wordpress plug-in collapses

Asked 2 years ago, Updated 2 years ago, 71 views

If you try to display the code surrounded by [js][/js], it will be covered in blocks.

<div>// String</div>
<div>vars=new String('taguti')</div>
<div>vars='taguti'// string literal → still available methods</div>
<div>console.log(s.length)</div>
<div>console.log(s.replace('ti', 'chi')</div>
<div>console.log(s.substr(1,3)))</div>

Confirmation

·htmlautoscript=>It doesn't matter.
·Removefileter()=>Not allowed in function.php
·Disable plug-in TinyMCE Advanced=>Relevant
·Remove_filter('the_content', 'wpautop') in function.php;=>It doesn't matter

javascript wordpress

2022-09-30 21:29

1 Answers

Event

The wordpress post screen has Visual Editor and Text Editor.
If you paste the javascript code into Visual Editor and switch to Text Editor, it will be "modified".

Solution

Paste the javascript code first in the Text Editor.Then, for some reason, it doesn't change.
This is an emergency measure, but this is the solution.We do not have the following filter settings.

Reference URL

I thought the automatic plastic surgery filter was related, but it didn't.(Maybe it's related, but I couldn't find a causal relationship)

How to Disable WordPress Auto-Shaping (including Visual Editor)
https://qiita.com/jyokyoku/items/c560b0d1eacc1df61620


2022-09-30 21:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.