Later on, they added the “Code” or “Text” tab to allow people to insert arbitrary code, but this had two problems:
- The code would often get badly mangled when you switched between views
- The code would be invisible in WYSIWYG mode because of the visual editor
The second problem was particularly pronounced when inserting stuff like JSON structured data, because there was no way of telling that the code was added!
This allowed us to insert header or body scripts into posts on a page by page basis. But of course, this too is flawed because you don’t have control over precisely where in the document the code goes – only some general options. Not to mention that all your customizations and code would vanish if you were to change your plugins and themes. Suffice to say, that none of this was satisfactory.
However, with WordPress 5.0 and Gutenberg, all that has changed. The WordPress developers finally decided to bring the editor in line with what WordPress has become – not just a WYSIWYG editor, but a page builder. And because of that, we now have Gutenberg blocks that allow us to easily do what used to be hard.
I initially disliked Gutenberg because I found it too distracting as a pure editor. As a writer, I might still feel that way, but as a site owner, I’ve started to see the value of “blocks”. I realize that my articles are not pure text, but consist of chunks of various types of content.
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!
I’ve learned to like Gutenberg.
But today, I need to insert some script code into the HEAD.
I haven’t figured out how to do that yet.
Can you provide some help?
Bhagwad Park says
You can use this guide we wrote earlier: https://www.namehero.com/knowledgebase/149/How-To-Add-Google-Analytics-To-WordPress.html
While it’s for Google Analytics scripts, it should be applicable everywhere.