When i enter HTML into redactor below it will strip out the first closing div and the second opening div leaving one col-md-6. It actually saves it as I have below but as soon as redactor is re-initialised it strips out the closing and opening tag in the middle again. This means no one can ever go in an edit the content as it will be a single column again once saved. Current setup of redactor is below and I have unchecked the clean HTML.

<div class="row">
    <div class="col-md-6">
        <p>One Col</p>
    <div class="col-md-6">
    <p>One Col</p>

Redactor JSON config:

        buttons: ['html','formatting','bold','italic','unorderedlist','orderedlist','link','image','video'],
        plugins: ['fullscreen'],
        toolbarFixedBox: true,
        replaceDivs: false
        replaceDivs: false,
        paragraphize: false,
        removeEmpty: ['strong', 'em', 'span', 'p']

Any ideas how I can get it just to accept the HTML we enter without problems?

  • 1
    Hi Andy, this doesn't answer your question but is something to consider; having 'complex' markup like this in a Rich Text field may not be the best idea, it might be worth considering a Matrix field (depending on the context here): buildwithcraft.com/docs/matrix-fields or another Craft field that handles purely the content, and the column markup is defined in your templates.
    – Jamie Wade
    Dec 22, 2014 at 17:16
  • Thansk for responding Jamie but this is actually a matrix field :( Its quite annoying!
    – Andy Lake
    Dec 22, 2014 at 17:22
  • You mean the RTE is inside of a Matrix field? What Jamie is suggesting is ditching the RTE altogether and solely use a Matrix field. You'll have much more control over the markup, then.
    – Brad Bell
    Dec 22, 2014 at 18:22

3 Answers 3


Have you tried using the allowedTags attribute in your Redactor config?

    allowedTags: ['div','p', 'h1', 'h2', 'pre']

You can read about that here:



Add replaceDivs: false only once in your JSON config and do not forget the comma at the end of each settings row.


For me adding replaceDivs: false in redactor config file fixed my issue on div tag removal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.