Can `<style>` and `<script>` tags be used in the HTML editor?

I understand this is so stupid, because absolutely there should be an answer out there, but I can't find it myself. In short, can you use style and script tags in the HTML editor, without any plugin or touching the style.css file? I am an author of a blog I don't own, and I would like to add custom styles on my articles. I try it and it seems that it doesn't work, but I would like to have a definite answer.

Topic html-editor css Wordpress javascript

Category Web


Mostly no, but you shouldn't do that anyway.

The exception, is if your user has the unfiltered_html capability, which is a dangerous power to have. Users that have this are admins on a single site install, or a super admin on a multisite install.

But, there are major security downside to putting script and style tags directly into articles.

For CSS, it's unnecessary, the customizer has a built in CSS editor. If your theme is built correctly, the body tag and main article/post tag will have IDs and classes you can use to target specific posts

For Javascript, this should be in the theme or a plugin. Entering javascript into the database opens up a security can of worms. If you must do it, do it via a custom field and some code, or a plugin. Don't do it via post content

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.