Filter scripts and other risky HTML from posts by every user, including administrators, to limit the damage of a stolen account.
define( 'DISALLOW_UNFILTERED_HTML', true );
Administrators and editors can normally put any HTML in posts, including <script> tags. If one of those accounts is compromised, an attacker can add malicious scripts to your pages. This constant makes WordPress filter everyone’s content the way it filters authors’ content.
DISALLOW_UNFILTERED_HTML removes the unfiltered_html capability from all users. Content they save is then run through wp_kses_post(), which removes scripts, inline event handlers and other unsafe markup while keeping normal formatting, links, images and embeds.
As an administrator, add a Custom HTML block containing <script>alert(1)</script> and save. Reload the editor: the script tag should be gone.