How can I dynamically remove some unwanted formatting tags inside rich text fields? I set up a Redactor config to add h3 headings only. If I copy-paste texts from a text edition software like Microsoft Word and uses h1 or h2 for example in his document, these un-wanted headings will be pasted in the rich text field. In another way, if I add an heading tag like &lt;h1&gt; in the source code mode of Redactor, this unwanted heading will also be added.

How can I prevent this and set a list of unwanted tags that could be dynamically deleted or converted in &lt;p&gt; ?

There are pasteBlockTags and pasteInlineTags options in the Redactor doc (https://imperavi.com/redactor/docs/settings/paste/#setting-pasteBlockTags), but it doesn't seems possible to add these options inside the JSON file stored in craft/config/redactor.

I also tried to add a new formattingAdd option, which I called Remove format, and replace unwanted tags by &lt;p&gt;, but this is an annoying solution because it needs to review each pieces of texts.
Not a "real" answer because it won't fix your actual content, but I wrote a plugin that would make it easy to remedy your issue on the front end (i.e. in the template) –

To remove all &lt;h1&gt; and &lt;h2&gt; tags (content inside tags will not be removed):

{{ entry.someRedactorField|retconChange(['h1','h2'], false) }}


To change &lt;h1&gt; and &lt;h2&gt; tags into &lt;p&gt; tags:

{{ entry.someRedactorField|retconChange(['h1','h2'], 'p') }}


You can read more about the rectonChange filter used in the two examples above here.