简体   繁体   中英

“Add custom HTML” block in WordPress previews my code perfectly, but when I come back, it's all messed up

I'm trying to add a custom HTML block to a page in WordPress. I paste in my code, check the preview and I see that it's working perfectly. But then I update it, and when I get back to the page, I get a bunch of gibberish and my code is edited.

Here's what it looks like in the preview: https://i.imgur.com/M6c5chr.png

And it remains functional even when I click "Update": https://i.imgur.com/Cb2Pif8.png

But when I try to visit the page again, it's all messed up: https://i.imgur.com/IbvWVdl.png

I noticed that WordPress removes all the script tags and all the tags that call a function when I visit the page again.

Does WordPress not allow script tags on HTML blocks, or do I have to do something with my code?

I read that I can use Code Snippets or Code Embed plugins to add Javascript codes. But I don't want to upgrade to business plan as I am just testing. Is there any way to make this work without paying?

您可以为此使用简码,通过简码,您可以在其中放入任何HTML或JS或PHP代码, 请参见参考

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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